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 --- 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); }