Commit fd6f2a17 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Check the display link running state as well as the window count to…

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: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 20aaf167
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment