[Mplayer-cvslog] CVS: main/libvo vo_gl.c,1.25,1.26 vo_gl2.c,1.18,1.19 vo_x11.c,1.107,1.108 vo_xmga.c,1.68,1.69 vo_xv.c,1.86,1.87 vo_xvidix.c,1.36,1.37 x11_common.c,1.83,1.84 x11_common.h,1.23,1.24

Arpi of Ize arpi at mplayerhq.hu
Wed May 15 01:44:38 CEST 2002


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv4015

Modified Files:
	vo_gl.c vo_gl2.c vo_x11.c vo_xmga.c vo_xv.c vo_xvidix.c 
	x11_common.c x11_common.h 
Log Message:
some cleanup, gl/gl2 updated to use vo_window

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- vo_gl.c	16 Apr 2002 17:41:29 -0000	1.25
+++ vo_gl.c	14 May 2002 23:44:35 -0000	1.26
@@ -52,13 +52,11 @@
 
 /* X11 related variables */
 //static Display *mydisplay;
-static Window mywindow;
+//static Window vo_window;
 //static GC mygc;
 //static XImage *myximage;
 //static int depth,mode;
 //static XWindowAttributes attribs;
-static int X_already_started = 0;
-
 //static int texture_id=1;
 
 static GLXContext wsGLXContext;
@@ -115,20 +113,17 @@
 	image_width = width;
 	image_format = format;
   
-	if (X_already_started) return -1;
 	if(!vo_init()) return -1;
 
 	aspect_save_orig(width,height);
 	aspect_save_prescale(d_width,d_height);
 	aspect_save_screenres(vo_screenwidth,vo_screenheight);
 
-	X_already_started++;
-
 	aspect(&d_width,&d_height,A_NOZOOM);
 #ifdef X11_FULLSCREEN
-        if( flags&0x01 ){ // (-fs)
-          aspect(&d_width,&d_height,A_ZOOM);
-        }
+//        if( flags&0x01 ){ // (-fs)
+//          aspect(&d_width,&d_height,A_ZOOM);
+//        }
 #endif
 	hint.x = 0;
 	hint.y = 0;
@@ -160,30 +155,31 @@
 	xswamask = CWBackPixel | CWBorderPixel | CWColormap;
 //  xswamask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWCursor | CWOverrideRedirect | CWSaveUnder | CWX | CWY | CWWidth | CWHeight;
 
-  mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
+  vo_window = XCreateWindow(mDisplay, mRootWin,
     hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
 
-  vo_x11_classhint( mDisplay,mywindow,"gl" );
-  vo_hidecursor(mDisplay,mywindow);
+  vo_x11_classhint( mDisplay,vo_window,"gl" );
+  vo_hidecursor(mDisplay,vo_window);
 
   wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
 //  XStoreName( wsDisplay,wsMyWin,wsSysName );
 
 //  printf("GLXcontext ok\n");
 
-  if ( flags&0x01 ) vo_x11_decoration( mDisplay,mywindow,0 );
+//  if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 );
 
-	XSelectInput(mDisplay, mywindow, StructureNotifyMask);
+	XSelectInput(mDisplay, vo_window, StructureNotifyMask);
 
 	/* Tell other applications about this window */
 
-	XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint);
+	XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
 
 	/* Map window. */
 
-	XMapWindow(mDisplay, mywindow);
+	XMapWindow(mDisplay, vo_window);
+	if ( flags&1 ) vo_x11_fullscreen();
 #ifdef HAVE_XINERAMA
-	vo_x11_xinerama_move(mDisplay,mywindow);
+	vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
 
 	/* Wait for map. */
@@ -191,24 +187,24 @@
 	{
 		XNextEvent(mDisplay, &xev);
 	}
-	while (xev.type != MapNotify || xev.xmap.event != mywindow);
+	while (xev.type != MapNotify || xev.xmap.event != vo_window);
 
-	XSelectInput(mDisplay, mywindow, NoEventMask);
+	XSelectInput(mDisplay, vo_window, NoEventMask);
 
-  glXMakeCurrent( mDisplay,mywindow,wsGLXContext );
+  glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
 
 	XFlush(mDisplay);
 	XSync(mDisplay, False);
 
-//	mygc = XCreateGC(mDisplay, mywindow, 0L, &xgcv);
+//	mygc = XCreateGC(mDisplay, vo_window, 0L, &xgcv);
 
-//		myximage = XGetImage(mDisplay, mywindow, 0, 0,
+//		myximage = XGetImage(mDisplay, vo_window, 0, 0,
 //		width, image_height, AllPlanes, ZPixmap);
 //		ImageData = myximage->data;
 //	bpp = myximage->bits_per_pixel;
 
-	//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
-        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask | PointerMotionMask
+	//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
+        XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
 #ifdef HAVE_NEW_INPUT
 		     | ButtonPressMask | ButtonReleaseMask
 #endif
@@ -325,8 +321,8 @@
 
 //  glFlush();
   glFinish();
-  glXSwapBuffers( mDisplay,mywindow );
-  
+  glXSwapBuffers( mDisplay,vo_window );
+ 
 }
 
 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
@@ -469,9 +465,9 @@
 static void
 uninit(void)
 {
+  if ( !vo_config_count ) return;
   saver_on(mDisplay); // screen saver back on
-
-  vo_x11_uninit(mDisplay, mywindow);
+  vo_x11_uninit();
 }
 
 static uint32_t preinit(const char *arg)
@@ -489,6 +485,9 @@
   switch (request) {
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
+  case VOCTRL_FULLSCREEN:
+    vo_x11_fullscreen();
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }

Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- vo_gl2.c	16 Apr 2002 17:41:29 -0000	1.18
+++ vo_gl2.c	14 May 2002 23:44:35 -0000	1.19
@@ -56,8 +56,7 @@
 static unsigned char *ImageData=NULL;
 
 /* X11 related variables */
-static Window mywindow;
-static int X_already_started = 0;
+//static Window vo_window;
 
 //static int texture_id=1;
 
@@ -623,7 +622,6 @@
 	image_width = width;
 	image_format = format;
   
-	if (X_already_started) return -1;
 	if(!vo_init()) return -1;
 
 	aspect_save_orig(width,height);
@@ -632,8 +630,6 @@
 
 	aspect(&d_width,&d_height,A_NOZOOM);
 
-	X_already_started++;
-
         if( flags&0x01 )
         {
 	        isFullscreen = GL_TRUE;
@@ -673,46 +669,46 @@
 	xswa.colormap         = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone);
 	xswamask = CWBackPixel | CWBorderPixel | CWColormap;
 
-  mywindow = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
+  vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen),
     hint.x, hint.y, hint.width, hint.height, 4, vinfo->depth,CopyFromParent,vinfo->visual,xswamask,&xswa);
 
-  vo_x11_classhint( mDisplay,mywindow,"gl2" );
-  vo_hidecursor(mDisplay,mywindow);
+  vo_x11_classhint( mDisplay,vo_window,"gl2" );
+  vo_hidecursor(mDisplay,vo_window);
 
   wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
 
-  if ( flags&0x01 ) vo_x11_decoration( mDisplay,mywindow,0 );
+  if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 );
 
-	XSelectInput(mDisplay, mywindow, StructureNotifyMask);
+	XSelectInput(mDisplay, vo_window, StructureNotifyMask);
 
 	/* Tell other applications about this window */
 
-	XSetStandardProperties(mDisplay, mywindow, hello, hello, None, NULL, 0, &hint);
+	XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint);
 
 	/* Map window. */
 
-	XMapWindow(mDisplay, mywindow);
+	XMapWindow(mDisplay, vo_window);
 #ifdef HAVE_XINERAMA
-	vo_x11_xinerama_move(mDisplay,mywindow);
+	vo_x11_xinerama_move(mDisplay,vo_window);
 #endif
-        XClearWindow(mDisplay,mywindow);
+        XClearWindow(mDisplay,vo_window);
 
 	/* Wait for map. */
 	do 
 	{
 		XNextEvent(mDisplay, &xev);
 	}
-	while (xev.type != MapNotify || xev.xmap.event != mywindow);
+	while (xev.type != MapNotify || xev.xmap.event != vo_window);
 
-	XSelectInput(mDisplay, mywindow, NoEventMask);
+	XSelectInput(mDisplay, vo_window, NoEventMask);
 
-  glXMakeCurrent( mDisplay,mywindow,wsGLXContext );
+  glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
 
 	XFlush(mDisplay);
 	XSync(mDisplay, False);
 
-	//XSelectInput(mDisplay, mywindow, StructureNotifyMask); // !!!!
-        XSelectInput(mDisplay, mywindow, StructureNotifyMask | KeyPressMask | PointerMotionMask
+	//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
+        XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
 #ifdef HAVE_NEW_INPUT
 		 | ButtonPressMask | ButtonReleaseMask
 #endif
@@ -1009,7 +1005,7 @@
 
 //  glFlush();
   glFinish();
-  glXSwapBuffers( mDisplay,mywindow );
+  glXSwapBuffers( mDisplay,vo_window );
   
   if(!used_info_done)
   {
@@ -1096,9 +1092,9 @@
 static void
 uninit(void)
 {
+  if ( !vo_config_count ) return;
   saver_on(mDisplay); // screen saver back on
-
-  vo_x11_uninit(mDisplay, mywindow);
+  vo_x11_uninit();
 }
 
 static uint32_t preinit(const char *arg)

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- vo_x11.c	13 May 2002 20:56:08 -0000	1.107
+++ vo_x11.c	14 May 2002 23:44:35 -0000	1.108
@@ -601,7 +601,7 @@
 #endif
 
  zoomFlag=0;
- vo_x11_uninit(mDisplay, vo_window);
+ vo_x11_uninit();
 
  freeSwsContext(swsContext);
 }

Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- vo_xmga.c	12 May 2002 16:01:08 -0000	1.68
+++ vo_xmga.c	14 May 2002 23:44:35 -0000	1.69
@@ -77,8 +77,6 @@
 
 static uint32_t               mDepth, bpp, mode;
 static XWindowAttributes      attribs;
-static uint32_t               X_already_started=0;
-
 static uint32_t               fgColor;
 
 static uint32_t               mvHeight;
@@ -195,7 +193,6 @@
 
  unsigned long          xswamask;
 
- if ( X_already_started ) return -1;
  if (!vo_init()) return -1;
 
  width+=width&1;
@@ -337,7 +334,7 @@
  inited=0;
  mga_uninit();
  saver_on(mDisplay);
- vo_x11_uninit(mDisplay, vo_window);
+ vo_x11_uninit();
  printf("vo: uninit!\n");
 }
 

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- vo_xv.c	11 May 2002 14:57:41 -0000	1.86
+++ vo_xv.c	14 May 2002 23:44:35 -0000	1.87
@@ -793,7 +793,7 @@
 #ifdef HAVE_XF86VM
  vo_vm_close(mDisplay);
 #endif
- if(vo_config_count) vo_x11_uninit(mDisplay, vo_window);
+ if(vo_config_count) vo_x11_uninit();
 
 #else
 
@@ -803,7 +803,7 @@
 #ifdef HAVE_XF86VM
  vo_vm_close(mDisplay);
 #endif
- vo_x11_uninit(mDisplay, vo_window);
+ vo_x11_uninit();
 
 #endif
 }

Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- vo_xvidix.c	11 May 2002 14:57:41 -0000	1.36
+++ vo_xvidix.c	14 May 2002 23:44:35 -0000	1.37
@@ -50,8 +50,6 @@
 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
 
 /* X11 related variables */
-static int X_already_started = 0;
-
 /* Colorkey handling */
 static XGCValues mGCV;
 static uint32_t	fgColor;
@@ -72,12 +70,12 @@
 static uint32_t window_width, window_height;
 
 /* used by XGetGeometry & XTranslateCoordinates for moving/resizing window */
-static Window mRoot;
 static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
     drwDepth, drwcX, drwcY, dwidth, dheight;
 
 static void set_window(int force_update,const vo_tune_info_t *info)
 {
+    Window mRoot;
     if ( WinID )
      {
       XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
@@ -417,7 +415,7 @@
     vidix_term();
 
     saver_on(mDisplay); /* screen saver back on */
-    vo_x11_uninit(mDisplay, vo_window);
+    vo_x11_uninit();
 }
 
 static uint32_t preinit(const char *arg)

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- x11_common.c	14 May 2002 11:41:02 -0000	1.83
+++ x11_common.c	14 May 2002 23:44:35 -0000	1.84
@@ -171,7 +171,8 @@
 	    event->error_code, event->request_code, event->minor_code);
     }
     
-    exit_player("X11 error");
+    abort();
+    //exit_player("X11 error");
 #undef MSGLEN
 }
 
@@ -517,7 +518,7 @@
 }
 
 Window     vo_window = None;
-GC         vo_gc;
+GC         vo_gc = NULL;
 XSizeHints vo_hint;
 
 #ifdef HAVE_NEW_GUI
@@ -526,27 +527,29 @@
  }
 #endif
 
-int vo_x11_uninit(Display *display, Window window)
+void vo_x11_uninit()
 {
-    vo_showcursor( display,window );
+    if(vo_window!=None) vo_showcursor( mDisplay,vo_window );
 
 #ifdef HAVE_NEW_GUI
     /* destroy window only if it's not controlled by GUI */
     if ( !use_gui )
 #endif
     {
-	XSetBackground( mDisplay,vo_gc,0 );
-	XClearWindow( mDisplay,vo_window );
-  
-	/* and -wid is set */
-	if (WinID < 0)
-	 {
-	  XUnmapWindow( display,window );
-	  XDestroyWindow(display, window);
-	 }
+	if(vo_gc){
+	  XSetBackground( mDisplay,vo_gc,0 );
+	  vo_gc=NULL;
+	}
+	if(vo_window!=None){
+	  XClearWindow( mDisplay,vo_window );
+	  if (WinID < 0){
+	    XUnmapWindow( mDisplay,vo_window );
+	    XDestroyWindow(mDisplay, vo_window);
+	  }
+	  vo_window=None;
+	}
 	vo_fs=0;
     }
-    return(1);
 }
 
        int vo_mouse_timer_const = 30;
@@ -562,7 +565,7 @@
 // unsigned long  vo_KeyTable[512];
 
  if ( ( vo_mouse_autohide )&&( --vo_mouse_counter == 0 ) ) vo_hidecursor( mydisplay,vo_window );
- 
+
  while ( XPending( mydisplay ) )
   {
    XNextEvent( mydisplay,&Event );
@@ -573,6 +576,7 @@
       if ( vo_window != Event.xany.window ) continue;
      }
    #endif
+//       printf("\rEvent.type=%X  \n",Event.type);
     switch( Event.type )
      {
       case Expose:

Index: x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- x11_common.h	8 May 2002 16:41:44 -0000	1.23
+++ x11_common.h	14 May 2002 23:44:35 -0000	1.24
@@ -34,6 +34,8 @@
 extern void vo_x11_sizehint( int x, int y, int width, int height, int max );
 extern int vo_x11_check_events(Display *mydisplay);
 extern void vo_x11_fullscreen( void );
+extern void vo_x11_uninit();
+
 #endif
 
 extern Window     vo_window;




More information about the MPlayer-cvslog mailing list