diff libvo/vo_x11.c @ 9278:caea8ed36b48

The reason why mplayer crashes (in some cases) when using x11 output and -wid (>0) parameter is this: Mplayer by default creates a colormap using DirectColor visual. If the window given to mplayer uses TrueColor visual there will be an error when mplayer sets the colormap for the window. This patch modifies mplayer to use TrueColor visual if the window given to mplayer uses TrueColor. Another solution is to make sure that the window given to mplayer is created using DirectColor visual if it is supported by the display. Jouni Tulkki <jitulkki@cc.hut.fi>
author arpi
date Tue, 04 Feb 2003 18:31:44 +0000
parents fc803aa85058
children 543ab3909b78
line wrap: on
line diff
--- a/libvo/vo_x11.c	Tue Feb 04 18:22:43 2003 +0000
+++ b/libvo/vo_x11.c	Tue Feb 04 18:31:44 2003 +0000
@@ -261,7 +261,8 @@
    Visual *visual;
    depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual);
  }
- if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ))
+ if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ) ||
+      WinID > 0 && vinfo.visualid != XVisualIDFromVisual(attribs.visual))
    XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
 
  /* set image size (which is indeed neither the input nor output size), 
@@ -298,7 +299,8 @@
 
     xswa.background_pixel=0;
     xswa.border_pixel=0;
-    xswamask=CWBackPixel | CWBorderPixel;
+    xswa.colormap=theCmap;
+    xswamask=CWBackPixel | CWBorderPixel | CWColormap;
 
 #ifdef HAVE_XF86VM
     if ( vm )
@@ -322,8 +324,6 @@
      {
       if ( vo_window == None )
        {
-        xswa.colormap=theCmap;
-        xswamask|=CWColormap;
         vo_window=XCreateWindow( mDisplay,mRootWin,
     			 vo_dx,vo_dy,
 			 vo_dwidth,vo_dheight,