From d3b68a283fd3d2e9a98a9fd5a617ec89448bd389 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Thu, 27 Jun 2013 12:27:34 +1000 Subject: w32_common: prevent display power management Handling SC_MONITORPOWER doesn't seem to prevent the screen from dimming. The recommended way to do this in Windows XP and Vista is to call SetThreadExecutionState with ES_DISPLAY_REQUIRED. Windows 7 also has the PowerCreateRequest/PowerSetRequest/PowerClearRequest APIs but they're probably too complicated for this task. --- video/out/w32_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 783bd7fb06..77433db885 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -705,9 +705,11 @@ int vo_w32_control(struct vo *vo, int *events, int request, void *arg) return VO_TRUE; case VOCTRL_KILL_SCREENSAVER: w32->disable_screensaver = true; + SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); return VO_TRUE; case VOCTRL_RESTORE_SCREENSAVER: w32->disable_screensaver = false; + SetThreadExecutionState(ES_CONTINUOUS); return VO_TRUE; case VOCTRL_UPDATE_WINDOW_TITLE: { wchar_t *title = mp_from_utf8(NULL, (char *)arg); @@ -733,6 +735,7 @@ void vo_w32_uninit(struct vo *vo) if (!w32) return; while (ShowCursor(1) < 0) { } + SetThreadExecutionState(ES_CONTINUOUS); DestroyWindow(w32->window); UnregisterClassW(classname, 0); talloc_free(w32); -- cgit v1.2.3