libobs: Don't use SPI_SETSCREENSAVEACTIVE on Windows

SetThreadExecutionState with ES_DISPLAY_REQUIRED has the same effect of preventing the screensaver from activating. Using SPI_SETSCREENSAVEACTIVE leaves the screensaver disabled system-wide if OBS crashes before it can re-enable it.
This commit is contained in:
Richard Stanway 2015-11-05 03:58:26 +01:00
parent b7f64c7482
commit 3671153a4f

View File

@ -734,7 +734,6 @@ void get_win_ver(struct win_version_info *info)
}
struct os_inhibit_info {
BOOL was_active;
bool active;
};
@ -752,18 +751,12 @@ bool os_inhibit_sleep_set_active(os_inhibit_t *info, bool active)
return false;
if (active) {
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0,
&info->was_active, 0);
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, false,
NULL, 0);
SetThreadExecutionState(
ES_CONTINUOUS |
ES_SYSTEM_REQUIRED |
ES_AWAYMODE_REQUIRED |
ES_DISPLAY_REQUIRED);
} else {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, info->was_active,
NULL, 0);
SetThreadExecutionState(ES_CONTINUOUS);
}