From 127a7068b75258d396776cc101aba0bef10a5cef Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 14 Apr 2011 23:10:23 +0100 Subject: 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 Reviewed-by: Colin Harrison --- hw/xwin/winblock.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 } -- cgit v1.2.3