Module: wine Branch: master Commit: fd6f2a1781354a1a86a0469abd0766afd6304005 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd6f2a1781354a1a86a0469abd...
Author: Ken Thomases ken@codeweavers.com Date: Fri Dec 8 02:54:06 2017 -0600
winemac: Check the display link running state as well as the window count to decide whether to start/stop it.
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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (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); }