[Mplayer-cvslog] CVS: main/libvo vo_gl2.c, 1.55, 1.56 vo_gl.c, 1.56, 1.57 x11_common.c, 1.179, 1.180

Reimar Döffinger CVS syncmail at mplayerhq.hu
Thu Nov 4 19:31:58 CET 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv30108/libvo

Modified Files:
	vo_gl2.c vo_gl.c x11_common.c 
Log Message:
more fullscreen fixes and gl2 uses setGlWindow.


Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- vo_gl2.c	28 Oct 2004 01:15:52 -0000	1.55
+++ vo_gl2.c	4 Nov 2004 18:31:55 -0000	1.56
@@ -73,7 +73,8 @@
 //static int texture_id=1;
 
 #ifndef GL_WIN32
-    static GLXContext wsGLXContext;
+    static XVisualInfo *gl_vinfo = NULL;
+    static GLXContext gl_context = 0;
 #endif
 
 static uint32_t image_width;
@@ -670,6 +671,8 @@
 }
 
 static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
+  if ( vo_window == None ) 
+  {
 	XSizeHints hint;
 	XVisualInfo *vinfo, vinfo_buf;
 	XEvent xev;
@@ -692,8 +695,6 @@
     return -1;
   }
 
-  if ( vo_window == None ) 
-   {
     vo_fs = VO_FALSE;
     vo_window = vo_x11_create_smooth_window(mDisplay, RootWindow(mDisplay,mScreen), 
 		                            vinfo->visual, hint.x, hint.y, hint.width, hint.height, vinfo->depth, vo_x11_create_colormap(vinfo));
@@ -718,49 +719,30 @@
 		XNextEvent(mDisplay, &xev);
 	}
 	while (xev.type != MapNotify || xev.xmap.event != vo_window);
-   }
-   else {
-   	vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 );
-   	// for changing from fullscreen to fullscreen we do fullscreen to
-   	// window and back to fullscreen, so that vo_x11_fullscreen saves
-   	// the correct size for _this_ video (and doesn't take the values from
-   	// the previous one)
-   	if (vo_fs)
-   	 vo_x11_fullscreen ();
-   	XMoveResizeWindow( mDisplay,vo_window,hint.x,hint.y,hint.width,hint.height );
-   }
-
-  // these would normally be set by the event handler, but here we have to
-  // do it manually
-  vo_dwidth = d_width;
-  vo_dheight = d_height;
-
-  if (flags & VOFLAG_FULLSCREEN)
-   vo_x11_fullscreen();
 
   vo_x11_classhint( mDisplay,vo_window,"gl2" );
   vo_hidecursor(mDisplay,vo_window);
   
-  if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
-
-  wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
-
-        glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
-
 	XSync(mDisplay, False);
 
 	//XSelectInput(mDisplay, vo_window, StructureNotifyMask); // !!!!
         vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
 		 | ButtonPressMask | ButtonReleaseMask | ExposureMask
         );
+  }
+  vo_x11_nofs_sizepos(0, 0, d_width, d_height);
+  if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
+    vo_x11_fullscreen();
 
-  if(glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz)!=0) 
+  setGlWindow(&gl_vinfo, &gl_context, vo_window);
+
+  if(glXGetConfig(mDisplay,gl_vinfo,GLX_RED_SIZE, &r_sz)!=0) 
 	  r_sz=0;
-  if(glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz)!=0) 
+  if(glXGetConfig(mDisplay,gl_vinfo,GLX_GREEN_SIZE, &g_sz)!=0) 
 	  g_sz=0;
-  if(glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz)!=0) 
+  if(glXGetConfig(mDisplay,gl_vinfo,GLX_BLUE_SIZE, &b_sz)!=0) 
 	  b_sz=0;
-  if(glXGetConfig(mDisplay,vinfo,GLX_ALPHA_SIZE, &a_sz)!=0) 
+  if(glXGetConfig(mDisplay,gl_vinfo,GLX_ALPHA_SIZE, &a_sz)!=0) 
 	  a_sz=0;
 
         return 0;
@@ -768,31 +750,15 @@
 
 #ifdef HAVE_NEW_GUI
 static int config_glx_gui(uint32_t d_width, uint32_t d_height) {
-  XWindowAttributes xw_attr;
-  XVisualInfo *vinfo, vinfo_template;
-  int tmp;
   vo_dwidth = d_width;
   vo_dheight = d_height;
   guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
-  XGetWindowAttributes(mDisplay, vo_window, &xw_attr);
-  vinfo_template.visualid=XVisualIDFromVisual(xw_attr.visual);
-  vinfo = XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp);
-
-  if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
-  wsGLXContext = glXCreateContext( mDisplay,vinfo,NULL,True );
-  if (wsGLXContext == NULL) {
-    mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] Could not create GLX context!\n");
-    XFree(vinfo);
-    return -1;
-  }
-  glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
-  XSync(mDisplay, False);
+  setGlWindow(&gl_vinfo, &gl_context, vo_window);
 
-  if (glXGetConfig(mDisplay,vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
-  if (glXGetConfig(mDisplay,vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
-  if (glXGetConfig(mDisplay,vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
-  if (glXGetConfig(mDisplay,vinfo,GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
-  XFree(vinfo);
+  if (glXGetConfig(mDisplay,gl_vinfo,GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
+  if (glXGetConfig(mDisplay,gl_vinfo,GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
+  if (glXGetConfig(mDisplay,gl_vinfo,GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
+  if (glXGetConfig(mDisplay,gl_vinfo,GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
   return 0;
 }
 #endif
@@ -1170,6 +1136,7 @@
 uninit(void)
 {
   if ( !vo_config_count ) return;
+  releaseGlContext(&gl_vinfo, &gl_context);
   if (texgrid) {
     free(texgrid);
     texgrid = NULL;

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- vo_gl.c	1 Nov 2004 20:24:37 -0000	1.56
+++ vo_gl.c	4 Nov 2004 18:31:55 -0000	1.57
@@ -256,8 +256,7 @@
 	XVisualInfo *vinfo;
 	XEvent xev;
 
-	vo_dwidth = d_width;
-	vo_dheight = d_height;
+	vo_fs = VO_FALSE;
 
 	hint.x = 0;
 	hint.y = 0;

Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- x11_common.c	1 Nov 2004 20:24:37 -0000	1.179
+++ x11_common.c	4 Nov 2004 18:31:55 -0000	1.180
@@ -1145,7 +1145,11 @@
     vo_old_height = height;
   }
   else
+  {
+   vo_dwidth = width;
+   vo_dheight = height;
    XMoveResizeWindow(mDisplay, vo_window, x, y, width, height);
+  }
 }
 
 void vo_x11_sizehint(int x, int y, int width, int height, int max)




More information about the MPlayer-cvslog mailing list