winex11: Move the screen saver support to a new SystemParametersInfo entry point.

This commit is contained in:
Alexandre Julliard 2012-11-15 17:46:37 +01:00
parent 13fbce5627
commit 67d16ddee3
2 changed files with 30 additions and 27 deletions

View file

@ -19,8 +19,6 @@
@ cdecl GetCursorPos(ptr) X11DRV_GetCursorPos
@ cdecl SetCursorPos(long long) X11DRV_SetCursorPos
@ cdecl ClipCursor(ptr) X11DRV_ClipCursor
@ cdecl GetScreenSaveActive() X11DRV_GetScreenSaveActive
@ cdecl SetScreenSaveActive(long) X11DRV_SetScreenSaveActive
@ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) X11DRV_ChangeDisplaySettingsEx
@ cdecl EnumDisplayMonitors(long ptr ptr long) X11DRV_EnumDisplayMonitors
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) X11DRV_EnumDisplaySettingsEx
@ -54,6 +52,7 @@
@ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) X11DRV_WindowPosChanging
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) X11DRV_WindowPosChanged
@ cdecl SystemParametersInfo(long long ptr long) X11DRV_SystemParametersInfo
# WinTab32
@ cdecl AttachEventQueueToTablet(long) X11DRV_AttachEventQueueToTablet

View file

@ -696,35 +696,39 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
return ret;
}
/***********************************************************************
* GetScreenSaveActive (X11DRV.@)
*
* Returns the active status of the screen saver
*/
BOOL CDECL X11DRV_GetScreenSaveActive(void)
{
int timeout, temp;
XGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp);
return timeout != 0;
}
/***********************************************************************
* SetScreenSaveActive (X11DRV.@)
*
* Activate/Deactivate the screen saver
* SystemParametersInfo (X11DRV.@)
*/
void CDECL X11DRV_SetScreenSaveActive(BOOL bActivate)
BOOL CDECL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
{
int timeout, interval, prefer_blanking, allow_exposures;
static int last_timeout = 15 * 60;
switch (action)
{
case SPI_GETSCREENSAVEACTIVE:
if (ptr_param)
{
int timeout, temp;
XGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp);
*(BOOL *)ptr_param = timeout != 0;
return TRUE;
}
break;
case SPI_SETSCREENSAVEACTIVE:
{
int timeout, interval, prefer_blanking, allow_exposures;
static int last_timeout = 15 * 60;
XLockDisplay( gdi_display );
XGetScreenSaver(gdi_display, &timeout, &interval, &prefer_blanking,
&allow_exposures);
if (timeout) last_timeout = timeout;
XLockDisplay( gdi_display );
XGetScreenSaver(gdi_display, &timeout, &interval, &prefer_blanking,
&allow_exposures);
if (timeout) last_timeout = timeout;
timeout = bActivate ? last_timeout : 0;
XSetScreenSaver(gdi_display, timeout, interval, prefer_blanking,
allow_exposures);
XUnlockDisplay( gdi_display );
timeout = int_param ? last_timeout : 0;
XSetScreenSaver(gdi_display, timeout, interval, prefer_blanking,
allow_exposures);
XUnlockDisplay( gdi_display );
}
break;
}
return FALSE; /* let user32 handle it */
}