# HG changeset patch # User Sam Lantinga # Date 1231741145 0 # Node ID 54fac87e1f34cb8522c4abfff1777702995033cd # Parent 1a08749aebce1fd71eb274095e6d53cf63e6c311 Added an API to enable/disable the screen saver. The screensaver is disabled by default when using SDL 1.2 compatibility. Use the new XScreenSaver extension, removed unused DPMS extension. diff -r 1a08749aebce -r 54fac87e1f34 configure.in --- a/configure.in Sun Jan 11 23:56:19 2009 +0000 +++ b/configure.in Mon Jan 12 06:19:05 2009 +0000 @@ -1020,6 +1020,7 @@ xrender_lib='/usr/X11R6/lib/libXrender.1.dylib' xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib' xinput_lib='/usr/X11R6/lib/libXi.6.dylib' + xss_lib='/usr/X11R6/lib/libXss.6.dylib' ;; *-*-osf*) x11_lib='libX11.so' @@ -1062,6 +1063,12 @@ xinput_lib=[`ls -- $path/libXi.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] fi fi + if test "x$xss_lib" = "x"; then + xss_lib=[`ls -- $path/libXss.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + if test "x$xss_lib" = "x"; then + xss_lib=[`ls -- $path/libXss.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] + fi + fi done ;; esac @@ -1124,13 +1131,6 @@ AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA) SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c" fi - AC_ARG_ENABLE(video-x11-xme, -AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]), - , enable_video_x11_xme=yes) - if test x$enable_video_x11_xme = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME) - SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c" - fi AC_ARG_ENABLE(video-x11-xrandr, AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), , enable_video_x11_xrandr=yes) @@ -1188,19 +1188,32 @@ if test x$definitely_enable_video_x11_xinput = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT) fi - AC_ARG_ENABLE(video-x11-dpms, -AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=yes]]]), - , enable_video_x11_dpms=yes) - if test x$enable_video_x11_dpms = xyes; then - AC_CHECK_HEADER(X11/extensions/dpms.h, - have_dpms_h_hdr=yes, - have_dpms_h_hdr=no, + AC_ARG_ENABLE(video-x11-scrnsaver, +AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]), + , enable_video_x11_scrnsaver=yes) + if test x$enable_video_x11_scrnsaver = xyes; then + AC_CHECK_HEADER(X11/extensions/scrnsaver.h, + have_scrnsaver_h_hdr=yes, + have_scrnsaver_h_hdr=no, [#include ]) - if test x$have_dpms_h_hdr = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_X11_DPMS) + if test x$have_scrnsaver_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then + echo "-- dynamic libXss -> $xss_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib") + definitely_enable_video_x11_scrnsaver=yes + else + AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes) + if test x$have_xss_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss" + definitely_enable_video_x11_scrnsaver=yes + fi + fi fi fi + if test x$definitely_enable_video_x11_scrnsaver = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER) + fi AC_ARG_ENABLE(render-x11, AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]), diff -r 1a08749aebce -r 54fac87e1f34 include/SDL_config.h.in --- a/include/SDL_config.h.in Sun Jan 11 23:56:19 2009 +0000 +++ b/include/SDL_config.h.in Mon Jan 12 06:19:05 2009 +0000 @@ -291,17 +291,17 @@ #undef SDL_VIDEO_DRIVER_WIN32 #undef SDL_VIDEO_DRIVER_WSCONS #undef SDL_VIDEO_DRIVER_X11 -#undef SDL_VIDEO_DRIVER_X11_DPMS #undef SDL_VIDEO_DRIVER_X11_DYNAMIC #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS #undef SDL_VIDEO_DRIVER_X11_VIDMODE #undef SDL_VIDEO_DRIVER_X11_XINERAMA -#undef SDL_VIDEO_DRIVER_X11_XME #undef SDL_VIDEO_DRIVER_X11_XRANDR #undef SDL_VIDEO_DRIVER_X11_XINPUT +#undef SDL_VIDEO_DRIVER_X11_SCRNSAVER #undef SDL_VIDEO_DRIVER_X11_XV #undef SDL_VIDEO_DRIVER_XBIOS diff -r 1a08749aebce -r 54fac87e1f34 include/SDL_video.h --- a/include/SDL_video.h Sun Jan 11 23:56:19 2009 +0000 +++ b/include/SDL_video.h Mon Jan 12 06:19:05 2009 +0000 @@ -1311,6 +1311,36 @@ */ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID); +/** + * \fn SDL_bool SDL_IsScreenSaverEnabled(); + * + * \brief Returns whether the screensaver is currently enabled (default off). + * + * \sa SDL_EnableScreenSaver() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(); + +/** + * \fn void SDL_EnableScreenSaver(); + * + * \brief Allow the screen to be blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(); + +/** + * \fn void SDL_DisableScreenSaver(); + * + * \brief Prevent the screen from being blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_EnableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(); + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* OpenGL support functions. */ diff -r 1a08749aebce -r 54fac87e1f34 src/SDL_compat.c --- a/src/SDL_compat.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/SDL_compat.c Mon Jan 12 06:19:05 2009 +0000 @@ -376,6 +376,26 @@ SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); } +static void +SetupScreenSaver() +{ + const char *env; + SDL_bool allow_screensaver; + + /* Allow environment override of screensaver disable */ + env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER"); + if (env) { + allow_screensaver = SDL_atoi(env) ? SDL_TRUE : SDL_FALSE; + } else { + allow_screensaver = SDL_FALSE; + } + if (allow_screensaver) { + SDL_EnableScreenSaver(); + } else { + SDL_DisableScreenSaver(); + } +} + int SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) { @@ -456,6 +476,7 @@ { SDL_DisplayMode desktop_mode; SDL_DisplayMode mode; + const char *env; int window_x = SDL_WINDOWPOS_UNDEFINED; int window_y = SDL_WINDOWPOS_UNDEFINED; Uint32 window_flags; @@ -679,6 +700,8 @@ ClearVideoSurface(); + SetupScreenSaver(); + /* We're finally done! */ return SDL_PublicSurface; } diff -r 1a08749aebce -r 54fac87e1f34 src/video/SDL_sysvideo.h --- a/src/video/SDL_sysvideo.h Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/SDL_sysvideo.h Mon Jan 12 06:19:05 2009 +0000 @@ -273,8 +273,12 @@ */ void (*PumpEvents) (_THIS); + /* Suspend the screensaver */ + void (*SuspendScreenSaver) (_THIS); + /* * * */ /* Data common to all drivers */ + SDL_bool suspend_screensaver; int num_displays; SDL_VideoDisplay *displays; int current_display; diff -r 1a08749aebce -r 54fac87e1f34 src/video/SDL_video.c --- a/src/video/SDL_video.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/SDL_video.c Mon Jan 12 06:19:05 2009 +0000 @@ -2326,6 +2326,45 @@ } } +SDL_bool +SDL_IsScreenSaverEnabled() +{ + if (!_this) { + return SDL_TRUE; + } + return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE; +} + +void +SDL_EnableScreenSaver() +{ + if (!_this) { + return; + } + if (!_this->suspend_screensaver) { + return; + } + _this->suspend_screensaver = SDL_FALSE; + if (_this->SuspendScreenSaver) { + _this->SuspendScreenSaver(_this); + } +} + +void +SDL_DisableScreenSaver() +{ + if (!_this) { + return; + } + if (_this->suspend_screensaver) { + return; + } + _this->suspend_screensaver = SDL_TRUE; + if (_this->SuspendScreenSaver) { + _this->SuspendScreenSaver(_this); + } +} + void SDL_VideoQuit(void) { diff -r 1a08749aebce -r 54fac87e1f34 src/video/Xext/extensions/xme.h --- a/src/video/Xext/extensions/xme.h Sun Jan 11 23:56:19 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 1993-2001 by Xi Graphics, Inc. - * All Rights Reserved. - * - * Please see the LICENSE file accompanying this distribution for licensing - * information. - * - * Please send any bug fixes and modifications to src@xig.com. - * - * $XiGId: xme.h,v 1.1.1.1 2001/11/19 19:01:10 jon Exp $ - * - */ - - -#ifndef _XME_H_INCLUDED -#define _XME_H_INCLUDED - -typedef struct -{ - short x; - short y; - unsigned short w; - unsigned short h; -} XiGMiscViewInfo; - -typedef struct -{ - unsigned short width; - unsigned short height; - int refresh; -} XiGMiscResolutionInfo; - -extern Bool XiGMiscQueryVersion(Display * dpy, int *major, int *minor); -extern int XiGMiscQueryViews(Display * dpy, int screen, - XiGMiscViewInfo ** pviews); -extern int XiGMiscQueryResolutions(Display * dpy, int screen, int view, - int *pactive, - XiGMiscResolutionInfo ** presolutions); -extern void XiGMiscChangeResolution(Display * dpy, int screen, int view, - int width, int height, int refresh); - -/* SDL addition from Ryan: free memory used by xme. */ -extern void XiGMiscDestroy(void); - -#endif /* _XME_H_INCLUDED */ -/* vi: set ts=4 sw=4 expandtab: */ diff -r 1a08749aebce -r 54fac87e1f34 src/video/cocoa/SDL_cocoaevents.m --- a/src/video/cocoa/SDL_cocoaevents.m Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/cocoa/SDL_cocoaevents.m Mon Jan 12 06:19:05 2009 +0000 @@ -164,6 +164,17 @@ { NSAutoreleasePool *pool; + /* Update activity every 30 seconds to prevent screensaver */ + if (_this->suspend_screensaver) { + SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; + Uint32 now = SDL_GetTicks(); + if (!data->screensaver_activity || + (int)(now-data->screensaver_activity) >= 30000) { + UpdateSystemActivity(UsrActivity); + data->screensaver_activity = now; + } + } + pool = [[NSAutoreleasePool alloc] init]; while ([NSApp isRunning]) { NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; diff -r 1a08749aebce -r 54fac87e1f34 src/video/cocoa/SDL_cocoavideo.h --- a/src/video/cocoa/SDL_cocoavideo.h Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/cocoa/SDL_cocoavideo.h Mon Jan 12 06:19:05 2009 +0000 @@ -49,6 +49,7 @@ int keyboard; void *key_layout; NSText *fieldEdit; + Uint32 screensaver_activity; } SDL_VideoData; #endif /* _SDL_cocoavideo_h */ diff -r 1a08749aebce -r 54fac87e1f34 src/video/win32/SDL_win32events.c --- a/src/video/win32/SDL_win32events.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/win32/SDL_win32events.c Mon Jan 12 06:19:05 2009 +0000 @@ -578,8 +578,8 @@ /* Don't start the screensaver or blank the monitor in fullscreen apps */ if ((wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER) { - if (SDL_GetWindowFlags(data->windowID) & - SDL_WINDOW_FULLSCREEN) { + SDL_VideoData *videodata = data->videodata; + if (videodata->suspend_screensaver) { return (0); } } diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11dyn.c --- a/src/video/x11/SDL_x11dyn.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11dyn.c Mon Jan 12 06:19:05 2009 +0000 @@ -62,6 +62,7 @@ {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT}, + {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS}, }; static void diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11events.c --- a/src/video/x11/SDL_x11events.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11events.c Mon Jan 12 06:19:05 2009 +0000 @@ -394,6 +394,16 @@ { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + /* Update activity every 30 seconds to prevent screensaver */ + if (_this->suspend_screensaver) { + Uint32 now = SDL_GetTicks(); + if (!data->screensaver_activity || + (int)(now-data->screensaver_activity) >= 30000) { + XResetScreenSaver(data->display); + data->screensaver_activity = now; + } + } + /* Keep processing pending events */ while (X11_Pending(data->display)) { X11_DispatchEvent(_this); @@ -401,61 +411,28 @@ } void -X11_SaveScreenSaver(Display * display, int *saved_timeout, BOOL * dpms) +X11_SuspendScreenSaver(_THIS) { - int timeout, interval, prefer_blank, allow_exp; - XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); - *saved_timeout = timeout; +#if SDL_VIDEO_DRIVER_X11_SCRNSAVER + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + int dummy; + int major_version, minor_version; -#if SDL_VIDEO_DRIVER_X11_DPMS - if (SDL_X11_HAVE_DPMS) { - int dummy; - if (DPMSQueryExtension(display, &dummy, &dummy)) { - CARD16 state; - DPMSInfo(display, &state, dpms); - } + if (!SDL_X11_HAVE_XSS) { + return; } -#else - *dpms = 0; -#endif /* SDL_VIDEO_DRIVER_X11_DPMS */ -} - -void -X11_DisableScreenSaver(Display * display) -{ - int timeout, interval, prefer_blank, allow_exp; - XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); - timeout = 0; - XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); -#if SDL_VIDEO_DRIVER_X11_DPMS - if (SDL_X11_HAVE_DPMS) { - int dummy; - if (DPMSQueryExtension(display, &dummy, &dummy)) { - DPMSDisable(display); - } + /* XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */ + if (!XScreenSaverQueryExtension(data->display, &dummy, &dummy) || + !XScreenSaverQueryVersion(data->display, + &major_version, &minor_version) || + major_version < 1 || (major_version == 1 && minor_version < 1)) { + return; } -#endif /* SDL_VIDEO_DRIVER_X11_DPMS */ -} -void -X11_RestoreScreenSaver(Display * display, int saved_timeout, BOOL dpms) -{ - int timeout, interval, prefer_blank, allow_exp; - XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); - timeout = saved_timeout; - XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); - -#if SDL_VIDEO_DRIVER_X11_DPMS - if (SDL_X11_HAVE_DPMS) { - int dummy; - if (DPMSQueryExtension(display, &dummy, &dummy)) { - if (dpms) { - DPMSEnable(display); - } - } - } -#endif /* SDL_VIDEO_DRIVER_X11_DPMS */ + XScreenSaverSuspend(data->display, _this->suspend_screensaver); + XResetScreenSaver(data->display); +#endif } /* vi: set ts=4 sw=4 expandtab: */ diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11events.h --- a/src/video/x11/SDL_x11events.h Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11events.h Mon Jan 12 06:19:05 2009 +0000 @@ -25,11 +25,7 @@ #define _SDL_x11events_h extern void X11_PumpEvents(_THIS); -extern void X11_SaveScreenSaver(Display * display, int *saved_timeout, - BOOL * dpms); -extern void X11_DisableScreenSaver(Display * display); -extern void X11_RestoreScreenSaver(Display * display, int saved_timeout, - BOOL dpms); +extern void X11_SuspendScreenSaver(_THIS); #endif /* _SDL_x11events_h */ diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11sym.h --- a/src/video/x11/SDL_x11sym.h Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11sym.h Mon Jan 12 06:19:05 2009 +0000 @@ -67,7 +67,6 @@ SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return) SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return) SDL_X11_SYM(int,XGetRGBColormaps,(Display* a,Window b,XStandardColormap **c,int *d,Atom e),(a,b,c,d,e),return) -SDL_X11_SYM(int,XGetScreenSaver,(Display* a,int* b,int* c,int* d,int* e),(a,b,c,d,e),return) SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return) SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return) SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return) @@ -102,6 +101,7 @@ SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return) SDL_X11_SYM(int,XRaiseWindow,(Display* a,Window b),(a,b),return) SDL_X11_SYM(int,XReparentWindow,(Display* a,Window b,Window c,int d,int e),(a,b,c,d,e),return) +SDL_X11_SYM(int,XResetScreenSaver,(Display* a),(a),return) SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return) SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return) SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return) @@ -111,7 +111,6 @@ SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return) SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return) SDL_X11_SYM(void,XSetRGBColormaps,( Display *a,Window b,XStandardColormap *c,int d,Atom e),(a,b,c,d,e),return) -SDL_X11_SYM(int,XSetScreenSaver,(Display* a,int b,int c,int d,int e),(a,b,c,d,e),return) SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return) SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return) SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),) @@ -212,15 +211,6 @@ SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(config),) #endif -/* DPMS support */ -#if SDL_VIDEO_DRIVER_X11_DPMS -SDL_X11_MODULE(DPMS) -SDL_X11_SYM(Status,DPMSQueryExtension,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) -SDL_X11_SYM(Status,DPMSInfo,(Display *dpy,CARD16 *state,BOOL *onoff),(dpy,state,onoff),return) -SDL_X11_SYM(Status,DPMSEnable,(Display *dpy),(dpy),return) -SDL_X11_SYM(Status,DPMSDisable,(Display *dpy),(dpy),return) -#endif - /* XInput support for multiple mice, tablets, etc. */ #if SDL_VIDEO_DRIVER_X11_XINPUT SDL_X11_MODULE(XINPUT) @@ -231,6 +221,14 @@ SDL_X11_SYM(int,XCloseDevice,(Display* a,XDevice* b),(a,b),return) #endif +/* MIT-SCREEN-SAVER support */ +#if SDL_VIDEO_DRIVER_X11_SCRNSAVER +SDL_X11_MODULE(XSS) +SDL_X11_SYM(Bool,XScreenSaverQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return) +SDL_X11_SYM(Status,XScreenSaverQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) +SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return) +#endif + /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11video.c --- a/src/video/x11/SDL_x11video.c Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11video.c Mon Jan 12 06:19:05 2009 +0000 @@ -169,6 +169,7 @@ device->SetDisplayMode = X11_SetDisplayMode; device->SetDisplayGammaRamp = X11_SetDisplayGammaRamp; device->GetDisplayGammaRamp = X11_GetDisplayGammaRamp; + device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; device->CreateWindow = X11_CreateWindow; @@ -224,11 +225,6 @@ } #endif - /* Save DPMS and screensaver settings */ - X11_SaveScreenSaver(data->display, &data->screensaver_timeout, - &data->dpms_enabled); - X11_DisableScreenSaver(data->display); - /* Look up some useful Atoms */ data->WM_DELETE_WINDOW = XInternAtom(data->display, "WM_DELETE_WINDOW", False); @@ -260,8 +256,6 @@ XCloseIM(data->im); } #endif - X11_RestoreScreenSaver(data->display, data->screensaver_timeout, - data->dpms_enabled); X11_QuitModes(_this); X11_QuitKeyboard(_this); diff -r 1a08749aebce -r 54fac87e1f34 src/video/x11/SDL_x11video.h --- a/src/video/x11/SDL_x11video.h Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/x11/SDL_x11video.h Mon Jan 12 06:19:05 2009 +0000 @@ -39,15 +39,12 @@ #if SDL_VIDEO_DRIVER_X11_VIDMODE #include "../Xext/extensions/xf86vmode.h" #endif -#if SDL_VIDEO_DRIVER_X11_XME -#include "../Xext/extensions/xme.h" -#endif -#if SDL_VIDEO_DRIVER_X11_DPMS -#include -#endif #if SDL_VIDEO_DRIVER_X11_XINPUT #include #endif +#if SDL_VIDEO_DRIVER_X11_SCRNSAVER +#include +#endif #include "SDL_x11dyn.h" @@ -66,8 +63,7 @@ Display *display; char *classname; XIM im; - int screensaver_timeout; - BOOL dpms_enabled; + Uint32 screensaver_activity; int numwindows; SDL_WindowData **windowlist; int windowlistlength;