From 9b70e77c64ce654a28188095a80676d72311f05f Mon Sep 17 00:00:00 2001 From: Kovensky Date: Thu, 11 Feb 2010 16:08:23 -0300 Subject: [PATCH] Added Windows screensaver disabling Disables the windows screensaver unconditionally for now. Periodically calls a function that resets the screensaver countdown timer. This change makes MPlayer ABI-incompatible with pre-win2000 OSes. --- mplayer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mplayer.c b/mplayer.c index e701d55bee..a703cc4b9f 100644 --- a/mplayer.c +++ b/mplayer.c @@ -8,8 +8,9 @@ #include "config.h" #include "talloc.h" -#if defined(__MINGW32__) || defined(__CYGWIN__) +#if _WIN32 #define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ +#define _WIN32_WINNT 0x0500 /* enable SetThreadExecutionState for disabling screensaver. Breaks binary compatibility with pre-win2000. */ #include #endif #include @@ -4127,6 +4128,9 @@ if(!mpctx->sh_video) { current_module = "stop_xscreensaver"; xscreensaver_heartbeat(mpctx->x11_state); } +#elif _WIN32 + current_module = "stop_screensaver"; + SetThreadExecutionState(ES_DISPLAY_REQUIRED); #endif if (heartbeat_cmd) { static unsigned last_heartbeat; -- 2.11.4.GIT