changeset 4815:178b524e5213

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) !!!
author albeu
date Sat, 23 Feb 2002 01:38:06 +0000
parents 23abc0e262e3
children f1dea39a50bb
files libvo/vo_x11.c libvo/vo_xv.c libvo/x11_common.c
diffstat 3 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Fri Feb 22 23:41:55 2002 +0000
+++ b/libvo/vo_x11.c	Sat Feb 23 01:38:06 2002 +0000
@@ -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 )
   {
--- a/libvo/vo_xv.c	Fri Feb 22 23:41:55 2002 +0000
+++ b/libvo/vo_xv.c	Sat Feb 23 01:38:06 2002 +0000
@@ -765,17 +765,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)
--- a/libvo/x11_common.c	Fri Feb 22 23:41:55 2002 +0000
+++ b/libvo/x11_common.c	Sat Feb 23 01:38:06 2002 +0000
@@ -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);
 }