src/video/x11/SDL_x11events.c
branchSDL-1.3
changeset 1659 14717b52abc0
parent 1658 e49147870aac
child 1662 782fd950bd46
     1.1 --- a/src/video/x11/SDL_x11events.c	Mon May 01 06:58:33 2006 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Wed May 17 08:18:28 2006 +0000
     1.3 @@ -291,11 +291,10 @@
     1.4  		     (xevent.xcrossing.mode != NotifyUngrab) ) {
     1.5  			if ( this->input_grab == SDL_GRAB_OFF ) {
     1.6  				posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
     1.7 -			} else {
     1.8 -				posted = SDL_PrivateMouseMotion(0, 0,
     1.9 -						xevent.xcrossing.x,
    1.10 -						xevent.xcrossing.y);
    1.11  			}
    1.12 +			posted = SDL_PrivateMouseMotion(0, 0,
    1.13 +					xevent.xcrossing.x,
    1.14 +					xevent.xcrossing.y);
    1.15  		}
    1.16  	    }
    1.17  	    break;
    1.18 @@ -1118,3 +1117,57 @@
    1.19  	X11_InitKeymap();
    1.20  }
    1.21  
    1.22 +void X11_SaveScreenSaver(Display *display, int *saved_timeout, BOOL *dpms)
    1.23 +{
    1.24 +	int timeout, interval, prefer_blank, allow_exp;
    1.25 +	XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
    1.26 +	*saved_timeout = timeout;
    1.27 +
    1.28 +#if SDL_VIDEO_DRIVER_X11_DPMS
    1.29 +	if ( SDL_X11_HAVE_DPMS ) {
    1.30 +		int dummy;
    1.31 +	  	if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
    1.32 +			CARD16 state;
    1.33 +			DPMSInfo(display, &state, dpms);
    1.34 +		}
    1.35 +	}
    1.36 +#else
    1.37 +	*dpms = 0;
    1.38 +#endif /* SDL_VIDEO_DRIVER_X11_DPMS */
    1.39 +}
    1.40 +
    1.41 +void X11_DisableScreenSaver(Display *display)
    1.42 +{
    1.43 +	int timeout, interval, prefer_blank, allow_exp;
    1.44 +	XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
    1.45 +	timeout = 0;
    1.46 +	XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
    1.47 +
    1.48 +#if SDL_VIDEO_DRIVER_X11_DPMS
    1.49 +	if ( SDL_X11_HAVE_DPMS ) {
    1.50 +		int dummy;
    1.51 +	  	if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
    1.52 +			DPMSDisable(display);
    1.53 +		}
    1.54 +	}
    1.55 +#endif /* SDL_VIDEO_DRIVER_X11_DPMS */
    1.56 +}
    1.57 +
    1.58 +void X11_RestoreScreenSaver(Display *display, int saved_timeout, BOOL dpms)
    1.59 +{
    1.60 +	int timeout, interval, prefer_blank, allow_exp;
    1.61 +	XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
    1.62 +	timeout = saved_timeout;
    1.63 +	XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
    1.64 +
    1.65 +#if SDL_VIDEO_DRIVER_X11_DPMS
    1.66 +	if ( SDL_X11_HAVE_DPMS ) {
    1.67 +		int dummy;
    1.68 +	  	if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
    1.69 +			if ( dpms ) {
    1.70 +				DPMSEnable(display);
    1.71 +			}
    1.72 +		}
    1.73 +	}
    1.74 +#endif /* SDL_VIDEO_DRIVER_X11_DPMS */
    1.75 +}