[Mplayer-cvslog] CVS: main/libvo x11_common.c,1.52,1.53 vo_x11.c,1.78,1.79 vo_xv.c,1.57,1.58

Alban Bedel CVS albeu at mplayer.dev.hu
Sat Feb 23 02:38:09 CET 2002


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

Modified Files:
	x11_common.c vo_x11.c vo_xv.c 
Log Message:
Bugfix in x11_common.c mainly. Don't screw up the display name,
don't forget to close the display (vo_xv) and to reset vo_depthonscreen
when we have destroyed the window and closed the display !!!!!
Open the display before using it (vo_x11) !!! 


Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- x11_common.c	22 Feb 2002 19:36:21 -0000	1.52
+++ x11_common.c	23 Feb 2002 01:38:06 -0000	1.53
@@ -170,6 +170,7 @@
  XImage  * mXImage = NULL;
 // Window    mRootWin;
  XWindowAttributes attribs;
+ char* dispName;
 
  if(vo_depthonscreen) return 1; // already called
 
@@ -180,16 +181,16 @@
    if (!(mDisplayName=getenv("DISPLAY")))
      mDisplayName=strdup(":0.0");
 #else
- mDisplayName = XDisplayName(mDisplayName);
+  dispName = XDisplayName(mDisplayName);
 #endif
 
  if (verbose)
-    printf("X11 opening display: %s\n", mDisplayName);
+    printf("X11 opening display: %s\n", dispName);
 
- mDisplay=XOpenDisplay(mDisplayName);
+ mDisplay=XOpenDisplay(dispName);
  if ( !mDisplay )
   {
-   printf( "vo: couldn't open the X11 display (%s)!\n",mDisplayName );
+   printf( "vo: couldn't open the X11 display (%s)!\n",dispName );
    return 0;
   }
  mScreen=DefaultScreen( mDisplay );     // Screen ID.
@@ -264,15 +265,15 @@
  }
 // XCloseDisplay( mDisplay );
 /* slightly improved local display detection AST */
- if ( strncmp(mDisplayName, "unix:", 5) == 0)
-		mDisplayName += 4;
- else if ( strncmp(mDisplayName, "localhost:", 10) == 0)
-		mDisplayName += 9;
- if (*mDisplayName==':') mLocalDisplay=1; else mLocalDisplay=0;
+ if ( strncmp(dispName, "unix:", 5) == 0)
+		dispName += 4;
+ else if ( strncmp(dispName, "localhost:", 10) == 0)
+		dispName += 9;
+ if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0;
  printf("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n",
 	vo_screenwidth,vo_screenheight,
 	depth, vo_depthonscreen,
-	mDisplayName,mLocalDisplay?"local":"remote");
+	dispName,mLocalDisplay?"local":"remote");
  
  return 1;
 }
@@ -425,6 +426,7 @@
 	if (!(WinID > 0))
 	    XDestroyWindow(display, window);
 	XCloseDisplay(display);
+	vo_depthonscreen = 0;
     }
     return(1);
 }

Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- vo_x11.c	22 Feb 2002 19:52:09 -0000	1.78
+++ vo_x11.c	23 Feb 2002 01:38:06 -0000	1.79
@@ -243,6 +243,12 @@
  static uint32_t vm_height;
 #endif
 
+#ifdef HAVE_NEW_GUI
+ if ( vo_window == None )
+#endif   
+    if( !vo_init() ) return 0; // Can't open X11
+
+
  if (!title)
     title = strdup("MPlayer X11 (XImage/Shm) render");
 
@@ -276,8 +282,6 @@
  if ( vo_window == None )
 #endif   
    {
-    if( !vo_init() ) return 0; // Can't open X11
-
     hint.x=0;
     hint.y=0;
     if(zoomFlag){
@@ -524,7 +528,7 @@
 
 static uint32_t query_format( uint32_t format )
 {
- if( !vo_init() ) return 0; // Can't open X11
+  //if( !vo_init() ) return 0; // Can't open X11
 
  switch( format )
   {

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- vo_xv.c	21 Feb 2002 21:11:01 -0000	1.57
+++ vo_xv.c	23 Feb 2002 01:38:06 -0000	1.58
@@ -764,17 +764,11 @@
 {
  int i;
  saver_on(mDisplay); // screen saver back on
-#ifdef HAVE_NEW_GUI
- if ( vo_window == None )
-#endif
- {
-  XDestroyWindow( mDisplay,vo_window );
- }
  for( i=0;i<num_buffers;i++ ) deallocate_xvimage( i );
 #ifdef HAVE_XF86VM
  vo_vm_close(mDisplay);
 #endif
-
+ vo_x11_uninit(mDisplay, vo_window);
 }
 
 static uint32_t preinit(const char *arg)




More information about the MPlayer-cvslog mailing list