diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2013-06-27 12:27:34 +1000 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2013-06-30 23:41:06 +1000 |
commit | d3b68a283fd3d2e9a98a9fd5a617ec89448bd389 (patch) | |
tree | f2ea1e737067f6d1d6a87aeff3f7d266eab0bc90 /video/out | |
parent | 0a1c49794531bf62dcbfb33e1f0adae5f14fe718 (diff) | |
download | mpv-d3b68a283fd3d2e9a98a9fd5a617ec89448bd389.tar.bz2 mpv-d3b68a283fd3d2e9a98a9fd5a617ec89448bd389.tar.xz |
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.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/w32_common.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |