Mercurial > mplayer.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
9277:d824f1a3c341 | 9278:caea8ed36b48 |
---|---|
259 | 259 |
260 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) { | 260 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) { |
261 Visual *visual; | 261 Visual *visual; |
262 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); | 262 depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual); |
263 } | 263 } |
264 if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo )) | 264 if ( !XMatchVisualInfo( mDisplay,mScreen,depth,DirectColor,&vinfo ) || |
265 WinID > 0 && vinfo.visualid != XVisualIDFromVisual(attribs.visual)) | |
265 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); | 266 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); |
266 | 267 |
267 /* set image size (which is indeed neither the input nor output size), | 268 /* set image size (which is indeed neither the input nor output size), |
268 if zoom is on it will be changed during draw_slice anyway so we dont dupplicate the aspect code here | 269 if zoom is on it will be changed during draw_slice anyway so we dont dupplicate the aspect code here |
269 */ | 270 */ |
296 | 297 |
297 theCmap=vo_x11_create_colormap(&vinfo); | 298 theCmap=vo_x11_create_colormap(&vinfo); |
298 | 299 |
299 xswa.background_pixel=0; | 300 xswa.background_pixel=0; |
300 xswa.border_pixel=0; | 301 xswa.border_pixel=0; |
301 xswamask=CWBackPixel | CWBorderPixel; | 302 xswa.colormap=theCmap; |
303 xswamask=CWBackPixel | CWBorderPixel | CWColormap; | |
302 | 304 |
303 #ifdef HAVE_XF86VM | 305 #ifdef HAVE_XF86VM |
304 if ( vm ) | 306 if ( vm ) |
305 { | 307 { |
306 xswa.override_redirect=True; | 308 xswa.override_redirect=True; |
320 } | 322 } |
321 else | 323 else |
322 { | 324 { |
323 if ( vo_window == None ) | 325 if ( vo_window == None ) |
324 { | 326 { |
325 xswa.colormap=theCmap; | |
326 xswamask|=CWColormap; | |
327 vo_window=XCreateWindow( mDisplay,mRootWin, | 327 vo_window=XCreateWindow( mDisplay,mRootWin, |
328 vo_dx,vo_dy, | 328 vo_dx,vo_dy, |
329 vo_dwidth,vo_dheight, | 329 vo_dwidth,vo_dheight, |
330 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); | 330 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); |
331 | 331 |