[PATCH 3/3] winemac: Stop the display link after 2 seconds of idleness, not the first time it's idle.
Ken Thomases
ken at codeweavers.com
Fri Dec 8 02:54:08 CST 2017
Signed-off-by: Ken Thomases <ken at 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);
}
--
2.10.2
More information about the wine-devel
mailing list