File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
src/detection/displayserver Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 33Bugfixes:
44
55* Fix builds on s390x (@jonathanspw , #402 )
6+ * Fix zero refresh rate on some monitors (macOS)
67
78# 1.9.0
89
Original file line number Diff line number Diff line change @@ -666,6 +666,7 @@ if(APPLE)
666666 PRIVATE "-framework OpenCL"
667667 PRIVATE "-framework Cocoa"
668668 PRIVATE "-framework CoreWLAN"
669+ PRIVATE "-framework CoreVideo"
669670 PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks"
670671 PRIVATE "-weak_framework DisplayServices -F /System/Library/PrivateFrameworks"
671672 )
Original file line number Diff line number Diff line change 66#include <string.h>
77#include <assert.h>
88#include <CoreGraphics/CGDirectDisplay.h>
9+ #include <CoreVideo/CVDisplayLink.h>
910
1011static void detectDisplays (FFDisplayServerResult * ds )
1112{
@@ -20,10 +21,25 @@ static void detectDisplays(FFDisplayServerResult* ds)
2021 CGDisplayModeRef mode = CGDisplayCopyDisplayMode (screen );
2122 if (mode )
2223 {
24+ //https://github.com/glfw/glfw/commit/aab08712dd8142b642e2042e7b7ba563acd07a45
25+ double refreshRate = CGDisplayModeGetRefreshRate (mode );
26+
27+ if (refreshRate == 0 )
28+ {
29+ CVDisplayLinkRef link ;
30+ if (CVDisplayLinkCreateWithCGDisplay (screen , & link ) == kCVReturnSuccess )
31+ {
32+ const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod (link );
33+ if (!(time .flags & kCVTimeIsIndefinite ))
34+ refreshRate = time .timeScale / (double ) time .timeValue + 0.5 ; //59.97...
35+ CVDisplayLinkRelease (link );
36+ }
37+ }
38+
2339 ffdsAppendDisplay (ds ,
2440 (uint32_t )CGDisplayModeGetPixelWidth (mode ),
2541 (uint32_t )CGDisplayModeGetPixelHeight (mode ),
26- (uint32_t )CGDisplayModeGetRefreshRate ( mode ) ,
42+ (uint32_t )refreshRate ,
2743 (uint32_t )CGDisplayModeGetWidth (mode ),
2844 (uint32_t )CGDisplayModeGetHeight (mode )
2945 );
You can’t perform that action at this time.
0 commit comments