diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-04-14 23:10:23 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-11-27 14:37:00 +0000 |
commit | 127a7068b75258d396776cc101aba0bef10a5cef (patch) | |
tree | bff81793b574831c459be622f89c3b0fba711f98 | |
parent | 190f165317c4a58adf38e3e32acfe7cf04850e91 (diff) |
hw/xwin: Allow XScreenSaverSuspend() to effect Windows screen saver or monitor power off
Reset the idle timer in the block handler if screenSaverSuspended is set.
This isn't quite a complete solution. We should also set the block timeout to
something less than the idle timer timeout to ensure we will reset the idle
timer before it times out if we are blocking.
The idle timer timeout is presumably the first one to expire of the screen saver
activation or monitor low power or power down timeout, depending on
configuration.
Unfortunately this is probably not straightforward to do. Whilst
SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT) is portable, apparently
SPI_GETLOWPOWERTIMEOUT and SPI_GETPOWEROFFTIMEOUT are not supported by Windows
versions 6.0 or later, and the interface for discovering equivalent value is
complex.
This doesn't matter in the case where a media player or similar application is
the one making the XScreenSaverSuspend() requests, as it will be continuously
drawing, causing the X server to become unblocked often.
In the case where slide show presentation application or similar is the one
making the XScreenSaverSuspend() request, this might be a problem.
Since "Powerpoint is Evil" [1], I think we'll leave it like this till someone
complains :-)
[1] http://www.edwardtufte.com/tufte/books_pp
v2: conditionalize on SCREENSAVER
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
-rw-r--r-- | hw/xwin/winblock.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c index 480e3bd48..a4ae8669f 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -86,4 +86,13 @@ winBlockHandler(ScreenPtr pScreen, DispatchMessage(&msg); } } + + /* + At least one X client has asked to suspend the screensaver, so + reset Windows' display idle timer + */ +#ifdef SCREENSAVER + if (screenSaverSuspended) + SetThreadExecutionState(ES_DISPLAY_REQUIRED); +#endif } |