Signed-off-by: Ken Thomases ken@codeweavers.com --- dlls/winemac.drv/cocoa_window.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 03a9e78..991db57 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -166,6 +166,8 @@ @interface WineDisplayLink : NSObject
NSTimeInterval _actualRefreshPeriod; NSTimeInterval _nominalRefreshPeriod; + + NSTimeInterval _lastDisplayTime; }
- (id) initWithDisplayID:(CGDirectDisplayID)displayID; @@ -224,7 +226,7 @@ - (void) addWindow:(WineWindow*)window [_windows addObject:window]; } if (firstWindow || !CVDisplayLinkIsRunning(_link)) - CVDisplayLinkStart(_link); + [self start]; }
- (void) removeWindow:(WineWindow*)window @@ -256,7 +258,11 @@ - (void) fire anyDisplayed = YES; } } - if (!anyDisplayed) + + NSTimeInterval now = [[NSProcessInfo processInfo] systemUptime]; + if (anyDisplayed) + _lastDisplayTime = now; + else if (_lastDisplayTime + 2.0 < now) CVDisplayLinkStop(_link); }); [windows release]; @@ -279,6 +285,7 @@ - (NSTimeInterval) refreshPeriod
- (void) start { + _lastDisplayTime = [[NSProcessInfo processInfo] systemUptime]; CVDisplayLinkStart(_link); }