[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.8,1.9 vo_xmga.c,1.9,1.10 vo_xv.c,1.6,1.7 x11_common.c,1.1,1.2 x11_common.h,1.1,1.2

Megyer Laszlo laaz at users.sourceforge.net
Tue Apr 10 02:00:07 CEST 2001


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

Modified Files:
	vo_x11.c vo_xmga.c vo_xv.c x11_common.c x11_common.h 
Log Message:
Szebb es jobb screensaver-kikapcsolo resz
xmga, xv, x11 support (sdl comming soon)


Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** vo_x11.c	2001/04/09 22:27:26	1.8
--- vo_x11.c	2001/04/10 00:00:04	1.9
***************
*** 29,33 ****
  #include <X11/Xutil.h>
  #include <X11/extensions/XShm.h>
- #include <X11/extensions/dpms.h>
  #ifdef HAVE_XF86VM
  #include <X11/extensions/xf86vmode.h>
--- 29,32 ----
***************
*** 68,73 ****
  static int X_already_started=0;
  
- static int timeout_save=0;
- static int dpms_disabled=0;
  //static int vo_dwidth,vo_dheight;
  
--- 67,70 ----
***************
*** 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;
  }
--- 338,342 ----
  // vo_initthread( mThread );
  
!  saver_off(mDisplay);
   return 0;
  }
***************
*** 536,582 ****
  {
   if( !vo_init() ) return 0; // Can't open X11
!  if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR ){
!    int bpp=format&0xFF;
!    if( bpp==vo_depthonscreen ) return 1;
!    if( bpp==15 && vo_depthonscreen==16) return 1; // built-in conversion
!    if( bpp==24 && vo_depthonscreen==32) return 1; // built-in conversion
!  }
   switch( format )
!  {
     case IMGFMT_YV12: return 1;
!  }
   return 0;
  }
  
  
- 
  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)
--- 516,532 ----
  {
   if( !vo_init() ) return 0; // Can't open X11
!  if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR && ( format&0xFF )==vo_depthonscreen ) return 1;
   switch( format )
!   {
     case IMGFMT_YV12: return 1;
!   }
   return 0;
  }
  
  
  static void
  uninit(void)
  {
! saver_on(mDisplay); // screen saver back on
  #ifdef HAVE_XF86VM
          if (vidmodes!=NULL)

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** vo_xmga.c	2001/03/25 04:28:40	1.9
--- vo_xmga.c	2001/04/10 00:00:04	1.10
***************
*** 274,277 ****
--- 274,279 ----
   XFlush( mDisplay );
   XSync( mDisplay,False );
+ 
+  saver_off(mDisplay);
  
   return 0;
***************
*** 285,288 ****
--- 287,291 ----
  uninit(void)
  {
+  saver_on(mDisplay);
   ioctl( f,MGA_VID_OFF,0 );
  printf("vo: uninit!\n");

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** vo_xv.c	2001/04/09 22:27:27	1.6
--- vo_xv.c	2001/04/10 00:00:04	1.7
***************
*** 25,29 ****
  #include <X11/Xutil.h>
  #include <X11/extensions/XShm.h>
- #include <X11/extensions/dpms.h>
  #include <errno.h>
  
--- 25,28 ----
***************
*** 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,
--- 79,82 ----
***************
*** 90,94 ****
  {
   int screen;
-  int nothing, interval, prefer_blank, allow_exp;
   char *hello = (title == NULL) ? "Xv render" : title;
   char *name = ":0.0";
--- 86,89 ----
***************
*** 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;
      }
--- 199,204 ----
         fprintf( stderr,"[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
        }
  
+      saver_off(mydisplay);  // turning off screen saver
       return 0;
      }
***************
*** 413,435 ****
  
  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);
!  }
! 
! 
  }
  
--- 392,396 ----
  
  static void uninit(void) {
!     saver_on(mydisplay); // screen saver back on
  }
  

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** x11_common.c	2001/03/03 21:47:37	1.1
--- x11_common.c	2001/04/10 00:00:04	1.2
***************
*** 11,14 ****
--- 11,15 ----
  #ifdef X11_FULLSCREEN
  
+ #include <X11/Xmd.h>
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
***************
*** 21,24 ****
--- 22,28 ----
  int vo_dheight=0;
  
+ static int dpms_disabled=0;
+ static int timeout_save=0;
+ 
  int vo_init( void )
  {
***************
*** 152,153 ****
--- 156,202 ----
  
  #endif
+ 
+ void saver_on(Display *mDisplay) {
+ 
+     int nothing;
+     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);
+ 	XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+     }
+ 
+ }
+ 
+ void saver_off(Display *mDisplay) {
+ 
+     int interval, prefer_blank, allow_exp, nothing;
+ 
+     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);
+ 		    // turning off screensaver
+ }
\ No newline at end of file

Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** x11_common.h	2001/03/03 21:47:37	1.1
--- x11_common.h	2001/04/10 00:00:04	1.2
***************
*** 1,2 ****
--- 1,3 ----
+ #include <X11/extensions/dpms.h>
  
  #ifdef X11_FULLSCREEN
***************
*** 11,15 ****
  void vo_x11_decoration( Display * vo_Display,Window w,int d );
  int vo_x11_check_events(Display *mydisplay);
- 
  #endif
  
--- 12,17 ----
  void vo_x11_decoration( Display * vo_Display,Window w,int d );
  int vo_x11_check_events(Display *mydisplay);
  #endif
  
+ void saver_off( Display * );
+ void saver_on( Display * );


_______________________________________________
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