1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-14 22:03:27 +01:00

SetThreadExecutionState for windows and SPI_SETSCREENSAVEACTIVE for WINE

This commit is contained in:
FunkyFr3sh 2024-11-30 23:39:11 +01:00
parent 7505295e33
commit 895db5bf93

View File

@ -132,6 +132,10 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
set_aware();
}
/* Make sure screensaver will stay off and monitors will stay on */
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
/* WINE does not support SetThreadExecutionState so we'll have to use SPI_SETSCREENSAVEACTIVE instead */
BOOL screensaver_enabled = FALSE;
SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_enabled, 0);
@ -161,6 +165,8 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
dinput_hook_exit();
hook_exit();
SetThreadExecutionState(ES_CONTINUOUS);
if (g_screensaver_disabled)
{
SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, TRUE, NULL, 0);