From owner-freebsd-multimedia Sun Feb 24 16:12:12 2002 Delivered-To: freebsd-multimedia@freebsd.org Received: from mailout.informatik.tu-muenchen.de (mailout.informatik.tu-muenchen.de [131.159.0.5]) by hub.freebsd.org (Postfix) with ESMTP id 4C9CB37B41A for ; Sun, 24 Feb 2002 16:12:02 -0800 (PST) Received: from mailrelay1.informatik.tu-muenchen.de (mailrelay.informatik.tu-muenchen.de [131.159.2.33]) by mailout.informatik.tu-muenchen.de (Postfix) with ESMTP id 286ED6194 for ; Mon, 25 Feb 2002 01:12:01 +0100 (MET) Received: from mailhalle.informatik.tu-muenchen.de (mailhalle.informatik.tu-muenchen.de [131.159.0.26]) by mailrelay1.informatik.tu-muenchen.de (Postfix) with ESMTP id 3911D7942 for ; Mon, 25 Feb 2002 01:12:01 +0100 (MET) Received: from kiste.foo.bar (sunrbg8.informatik.tu-muenchen.de [131.159.24.124]) by mailhalle.informatik.tu-muenchen.de (Postfix) with ESMTP id 981E16CB0A for ; Mon, 25 Feb 2002 01:11:53 +0100 (MET) Received: by kiste.foo.bar (Postfix, from userid 1000) id 778FA37CFD; Sun, 24 Feb 2002 23:40:13 +0100 (CET) Date: Sun, 24 Feb 2002 23:40:13 +0100 From: Simon Barner To: multimedia@freebsd.org Subject: fxtv - Patches to turn off screen saver while in full screen mode Message-ID: <20020224234013.A5689@simonbarner.myfqdn.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, first of all, thank you a lot for fxtv :-) I have added support to turn off the screen saver of the X window system. This works also with dpms (you can turn off dpms support in the Makefile, I have added a switch there). The code was taken from the graphics/mplayer port (GPL). Regards, Simon --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-Makefile --- Makefile.orig Sun Feb 24 23:29:26 2002 +++ Makefile Sun Feb 24 23:29:44 2002 @@ -4,6 +4,10 @@ HAVE_XFREE86 = YES +# Do we have DPMS support? +# Turn off in full screen mode (Simon Barner # include #endif + +/* + 24.02.2002 Simon Barner + + Undefine HAVE_XDPMS in the Makefile if your X-Installation does not support + DPMS video blanking. + + Needed to turn of the screen saver while in fullscreen mode. +*/ +#ifdef HAVE_XDPMS +#include +#endif + #include #include #include @@ -89,6 +102,108 @@ /**@BEGINFUNC************************************************************** + Prototype : void saver_on (Display *display) + + Purpose : Turn on X screen saver (used when coming back from + full screen mode) + + Programmer : 24-Feb-02 Simon Barner + + Parameters : Display *display + + Returns : void + + Globals : timeout_save, dpms_disabled; + (shared with saver_off to keep screen saver settings + **@ENDFUNC*****************************************************************/ +static int timeout_save=0, + dpms_disabled=0; + +void saver_on(Display *display) { +#ifdef HAVE_XDPMS + int nothing; + if (dpms_disabled) { + if (DPMSQueryExtension(display, ¬hing, ¬hing)) { + if (!DPMSEnable(display)) { + // restoring power saving settings + //printf("DPMS not available?\n"); + } else { + // DPMS does not seem to be enabled unless we call DPMSInfo + BOOL onoff; + CARD16 state; + DPMSInfo(display, &state, &onoff); + + + if (onoff) { + printf ("Successfully enabled DPMS\n"); + } else { + printf ("Could not enable DPMS\n"); + } + + + } + } + } +#endif + + if (timeout_save) { + int dummy, + interval, + prefer_blank, + allow_exp; + + XGetScreenSaver(display, &dummy, &interval, &prefer_blank, &allow_exp); + XSetScreenSaver(display, timeout_save, interval, prefer_blank, allow_exp); + XGetScreenSaver(display, &timeout_save, &interval, &prefer_blank, &allow_exp); + } +} + +/**@BEGINFUNC************************************************************** + + Prototype : void saver_off (Display *display) + + Purpose : Turn off X screen saver (used in full screen mode) + + Programmer : 24-Feb-02 Simon Barner + + Parameters : Display *display + + Returns : void + + Globals : timeout_save, dpms_disabled; + (shared with saver_on to keep screen saver settings + **@ENDFUNC*****************************************************************/ +void saver_off(Display *display) { + int interval, + prefer_blank, + allow_exp, + nothing; +#ifdef HAVE_XDPMS + + + if (DPMSQueryExtension(display, ¬hing, ¬hing)) { + BOOL onoff; + CARD16 state; + DPMSInfo(display, &state, &onoff); + if (onoff) { + Status stat; + // printf ("Disabling DPMS\n"); + dpms_disabled=1; + stat = DPMSDisable(display); // monitor powersave off + // printf ("stat: %d\n", stat); + } + } +#endif + + XGetScreenSaver(display, &timeout_save, &interval, &prefer_blank, &allow_exp); + if (timeout_save) { + XSetScreenSaver(display, 0, interval, prefer_blank, allow_exp); + // turning off screensaver + } +} + +/**@BEGINFUNC************************************************************** + Prototype : static INT32 TVSCREENGetCurVidMode( TV_XSCREEN *s ) @@ -379,8 +494,9 @@ static void TVSCREENAtExit() { - if ( !G_in_x_error ) + if ( !G_in_x_error ) { TVSCREENSetZoomState( FALSE, FALSE ); + } } @@ -2256,6 +2372,9 @@ if ( zoom_on ) { if ( full_screen ) { + // turn off screen saver while in full screen mode + saver_off (TVDISPLAY); + XRaiseWindow( TVDISPLAY, XtWindow(d->shell_wgt) ); /* Lock out the mouse so user can't move off the TV. */ @@ -2290,6 +2409,13 @@ } } else { + /* Turn the screen saver on again + + We do not check for fullscreen because on exit this function + is called with (FALSE, FALSE) Arguments + */ + saver_on (TVDISPLAY); + if ( d->unzoomed.mode >= 0 ) { if ( cur_vm != d->unzoomed.mode ) { new_vm = d->unzoomed.mode; --fdj2RfSjLxBAspz7-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message