diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 01:38:06 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 01:38:06 +0000 |
commit | 64ae87b5e49f90321ccc3c17401d1695e9de9c1b (patch) | |
tree | f910fa4b199351bcc7b29246fcad08506ef6923e /libvo | |
parent | 3687495972a4dcb9b5b27d21a203a5212d6db2d2 (diff) | |
download | mpv-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')
-rw-r--r-- | libvo/vo_x11.c | 10 | ||||
-rw-r--r-- | libvo/vo_xv.c | 8 | ||||
-rw-r--r-- | libvo/x11_common.c | 22 |
3 files changed, 20 insertions, 20 deletions
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index 96578e36a7..986ce8d327 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -243,6 +243,12 @@ static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t 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 @@ static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t 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 draw_frame( uint8_t *src[] ){ 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 ) { diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index c270025a02..025ac350e4 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -765,17 +765,11 @@ static void uninit(void) { 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) 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); } |