[PATCH 1/3] winemac: Check the display link running state as well as the window count to decide whether to start/stop it.
Ken Thomases
ken at codeweavers.com
Fri Dec 8 02:54:06 CST 2017
The display link may be stopped even if there are associated windows, due to
idleness. So, it may need to be started when a window is added even if it's
not the first window.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
dlls/winemac.drv/cocoa_window.m | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 65dc392..1b1d171 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -218,25 +218,25 @@ - (void) dealloc
- (void) addWindow:(WineWindow*)window
{
- BOOL needsStart;
+ BOOL firstWindow;
@synchronized(self) {
- needsStart = !_windows.count;
+ firstWindow = !_windows.count;
[_windows addObject:window];
}
- if (needsStart)
+ if (firstWindow || !CVDisplayLinkIsRunning(_link))
CVDisplayLinkStart(_link);
}
- (void) removeWindow:(WineWindow*)window
{
- BOOL shouldStop = FALSE;
+ BOOL lastWindow = FALSE;
@synchronized(self) {
- BOOL wasRunning = _windows.count > 0;
+ BOOL hadWindows = _windows.count > 0;
[_windows removeObject:window];
- if (wasRunning && !_windows.count)
- shouldStop = TRUE;
+ if (hadWindows && !_windows.count)
+ lastWindow = TRUE;
}
- if (shouldStop)
+ if (lastWindow && CVDisplayLinkIsRunning(_link))
CVDisplayLinkStop(_link);
}
--
2.10.2
More information about the wine-devel
mailing list