summaryrefslogtreecommitdiffstats
path: root/libvo/x11_common.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-23 01:38:06 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-23 01:38:06 +0000
commit64ae87b5e49f90321ccc3c17401d1695e9de9c1b (patch)
treef910fa4b199351bcc7b29246fcad08506ef6923e /libvo/x11_common.c
parent3687495972a4dcb9b5b27d21a203a5212d6db2d2 (diff)
downloadmpv-64ae87b5e49f90321ccc3c17401d1695e9de9c1b.tar.bz2
mpv-64ae87b5e49f90321ccc3c17401d1695e9de9c1b.tar.xz
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) !!! git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4816 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r--libvo/x11_common.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index b0e20ae8fc..5a7a12373f 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -170,6 +170,7 @@ int vo_init( void )
XImage * mXImage = NULL;
// Window mRootWin;
XWindowAttributes attribs;
+ char* dispName;
if(vo_depthonscreen) return 1; // already called
@@ -180,16 +181,16 @@ int vo_init( void )
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 @@ int vo_init( void )
}
// 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 @@ int vo_x11_uninit(Display *display, Window window)
if (!(WinID > 0))
XDestroyWindow(display, window);
XCloseDisplay(display);
+ vo_depthonscreen = 0;
}
return(1);
}