winemac: Stop the CVDisplayLink when there are no more changes to flush.
commitb4fc81bdf28264c381719966ead058fcafe299ce
authorKen Thomases <ken@codeweavers.com>
Tue, 10 Nov 2015 02:31:22 +0000 (9 20:31 -0600)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 10 Nov 2015 02:58:42 +0000 (10 11:58 +0900)
tree82af264b265672818e441ce7565dadd0c2146d95
parentd6574111c20d130a40c09ce0762ceb0a5461ada0
winemac: Stop the CVDisplayLink when there are no more changes to flush.

The change to a CVDisplayLink-driven display mechanism introduced a problem: a
Wine process never went completely idle for long periods.  The display link
would fire for every refresh cycle of the display, waking a CPU from idle and
wasting energy.

To fix that, I have the display link stop itself when it determines that none
of its windows need to be displayed.  When a window is subsequently marked as
needing display, it either temporarily re-enables Cocoa's normal autodisplay
mechanism so that it displays at the end of the current turn of the run loop,
or it restarts the display link.  It chooses the former if it's been a long
time since the window was last displayed so that the display is done more
immediately.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/winemac.drv/cocoa_window.h
dlls/winemac.drv/cocoa_window.m