[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.7,1.8 vo_xv.c,1.5,1.6

Megyer Laszlo laaz at users.sourceforge.net
Tue Apr 10 00:27:29 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv6135

Modified Files:
	vo_x11.c vo_xv.c 
Log Message:
Screensaver and monitor powersafe function is switched off when playing a
movie.


Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** vo_x11.c	2001/04/07 21:27:57	1.7
--- vo_x11.c	2001/04/09 22:27:26	1.8
***************
*** 29,32 ****
--- 29,33 ----
  #include <X11/Xutil.h>
  #include <X11/extensions/XShm.h>
+ #include <X11/extensions/dpms.h>
  #ifdef HAVE_XF86VM
  #include <X11/extensions/xf86vmode.h>
***************
*** 67,70 ****
--- 68,73 ----
  static int X_already_started=0;
  
+ static int timeout_save=0;
+ static int dpms_disabled=0;
  //static int vo_dwidth,vo_dheight;
  
***************
*** 112,115 ****
--- 115,119 ----
  {
   int screen;
+  int interval, prefer_blank, allow_exp, nothing;
   unsigned int fg,bg;
   char *hello=( title == NULL ) ? "X11 render" : title;
***************
*** 139,143 ****
     return -1;
    }
- 
   screen=DefaultScreen( mDisplay );
  
--- 143,146 ----
***************
*** 338,341 ****
--- 341,362 ----
  // vo_initthread( mThread );
  
+  if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
+  {
+      BOOL onoff;
+      CARD16 state;
+      DPMSInfo(mDisplay, &state, &onoff);
+      if (onoff)
+      {
+ 	 printf ("Disabling DPMS\n");
+ 	 dpms_disabled=1;
+          DPMSDisable(mDisplay);  // monitor powersave off
+      }
+  }
+ 
+  XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+  if (timeout_save)                                                       
+    XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
+ 			     // switching off screensaver
+ 
   return 0;
  }
***************
*** 529,535 ****
--- 550,582 ----
  
  
+ 
  static void
  uninit(void)
  {
+ 
+  int nothing;
+ 
+ // DMPSEnable doesn't work if there isn't a DPMSQueryExtension after it.
+ // XSetScreenSaver doesn't work if there isn't an XGetScreensaver after it.
+ 
+ if (dpms_disabled)
+  {
+      if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
+      {
+          printf ("Enabling DPMS\n");
+          DPMSEnable(mDisplay);  // restoring power saving settings
+ 	 DPMSQueryExtension(mDisplay, &nothing, &nothing);
+      }
+  }
+ 
+  if (timeout_save)
+  {
+      int dummy, interval, prefer_blank, allow_exp;
+      XGetScreenSaver(mDisplay, &dummy, &interval, &prefer_blank, &allow_exp);
+      XSetScreenSaver(mDisplay, timeout_save, interval, prefer_blank, allow_exp); // screensaver
+      XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+  }
+ 
+ 
  #ifdef HAVE_XF86VM
          if (vidmodes!=NULL)

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** vo_xv.c	2001/03/29 16:06:36	1.5
--- vo_xv.c	2001/04/09 22:27:27	1.6
***************
*** 25,28 ****
--- 25,29 ----
  #include <X11/Xutil.h>
  #include <X11/extensions/XShm.h>
+ #include <X11/extensions/dpms.h>
  #include <errno.h>
  
***************
*** 79,82 ****
--- 80,86 ----
  static uint32_t               drwcX,drwcY,dwidth,dheight,mFullscreen;
  
+ static int timeout_save=0;
+ static int dpms_disabled=0;
+ 
  /*
   * connect to server, create and map window,
***************
*** 86,89 ****
--- 90,94 ----
  {
   int screen;
+  int nothing, interval, prefer_blank, allow_exp;
   char *hello = (title == NULL) ? "Xv render" : title;
   char *name = ":0.0";
***************
*** 199,202 ****
--- 204,225 ----
         fprintf( stderr,"[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
        }
+ 
+     if (DPMSQueryExtension(mydisplay, &nothing, &nothing))
+     {
+ 	BOOL onoff;
+ 	CARD16 state;
+ 	DPMSInfo(mydisplay, &state, &onoff);
+ 	if (onoff)
+ 	{
+ 	    dpms_disabled=1;
+ 	    DPMSDisable(mydisplay);  // monitor powersave off
+ 	}
+     }
+ 
+     XGetScreenSaver(mydisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+     if (timeout_save)
+ 	XSetScreenSaver(mydisplay, 0, interval, prefer_blank, allow_exp);
+ 			// switching off screensaver
+ 
       return 0;
      }
***************
*** 389,393 ****
  }
  
! static void uninit(void) { }
  
  
--- 412,436 ----
  }
  
! static void uninit(void) {
!  int nothing;
!  if (DPMSQueryExtension(mydisplay, &nothing, &nothing))
!  {
!      if (dpms_disabled)
!      {
!  	DPMSEnable(mydisplay);  // restoring power saving settings
! 	DPMSQueryExtension(mydisplay, &nothing, &nothing);
!      }
!  }
! 
!  if (timeout_save)
!  {
!      int interval, prefer_blank, allow_exp, dummy;
!      XGetScreenSaver(mydisplay, &dummy, &interval, &prefer_blank, &allow_exp);
!      XSetScreenSaver(mydisplay, timeout_save, interval, prefer_blank, allow_exp);
!      XGetScreenSaver(mydisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
!  }
! 
! 
! }
  
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list