winemac: Stop the display link after 2 seconds of idleness, not the first time it's idle.
Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4e9c3444fb
commit
5f80cc43bf
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue