Mercurial > mplayer.hg
comparison libvo/vo_x11.c @ 6045:a4705acc43e5
fix Nil's vo_x11 bug (Nilmoni Deb <ndeb@ece.cmu.edu>)
author | pontscho |
---|---|
date | Sat, 11 May 2002 16:54:15 +0000 |
parents | 421781c5b128 |
children | c0ae8c0eda72 |
comparison
equal
deleted
inserted
replaced
6044:153fc4ed86ad | 6045:a4705acc43e5 |
---|---|
235 // int screen; | 235 // int screen; |
236 int fullscreen=0; | 236 int fullscreen=0; |
237 int vm=0; | 237 int vm=0; |
238 // int interval, prefer_blank, allow_exp, nothing; | 238 // int interval, prefer_blank, allow_exp, nothing; |
239 unsigned int fg,bg; | 239 unsigned int fg,bg; |
240 XSizeHints hint; | |
241 XEvent xev; | 240 XEvent xev; |
242 XGCValues xgcv; | 241 XGCValues xgcv; |
243 Colormap theCmap; | 242 Colormap theCmap; |
244 XSetWindowAttributes xswa; | 243 XSetWindowAttributes xswa; |
245 unsigned long xswamask; | 244 unsigned long xswamask; |
288 #ifdef HAVE_NEW_GUI | 287 #ifdef HAVE_NEW_GUI |
289 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window | 288 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window |
290 else | 289 else |
291 #endif | 290 #endif |
292 { | 291 { |
293 hint.x=vo_dx; | |
294 hint.y=vo_dy; | |
295 hint.width=width; | |
296 hint.height=height; | |
297 | 292 |
298 #ifdef HAVE_XF86VM | 293 #ifdef HAVE_XF86VM |
299 if ( vm ) | 294 if ( vm ) |
300 { | 295 { |
301 if ((d_width==0) && (d_height==0)) | 296 if ((d_width==0) && (d_height==0)) |
302 { vm_width=image_width; vm_height=image_height; } | 297 { vm_width=image_width; vm_height=image_height; } |
303 else | 298 else |
304 { vm_width=d_width; vm_height=d_height; } | 299 { vm_width=d_width; vm_height=d_height; } |
305 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); | 300 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); |
306 hint.x=(vo_screenwidth-modeline_width)/2; | 301 vo_dx=(vo_screenwidth-modeline_width)/2; |
307 hint.y=(vo_screenheight-modeline_height)/2; | 302 vo_dy=(vo_screenheight-modeline_height)/2; |
308 hint.width=modeline_width; | 303 vo_dwidth=modeline_width; |
309 hint.height=modeline_height; | 304 vo_dheight=modeline_height; |
310 } | 305 } |
311 #endif | 306 #endif |
312 hint.flags=PPosition | PSize; | |
313 | |
314 bg=WhitePixel( mDisplay,mScreen ); | 307 bg=WhitePixel( mDisplay,mScreen ); |
315 fg=BlackPixel( mDisplay,mScreen ); | 308 fg=BlackPixel( mDisplay,mScreen ); |
316 vo_dwidth=hint.width; | 309 |
317 vo_dheight=hint.height; | 310 theCmap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone ); |
318 | |
319 theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,mScreen ), | |
320 vinfo.visual,AllocNone ); | |
321 | 311 |
322 xswa.background_pixel=0; | 312 xswa.background_pixel=0; |
323 xswa.border_pixel=0; | 313 xswa.border_pixel=0; |
324 xswa.colormap=theCmap; | 314 xswa.colormap=theCmap; |
325 xswamask=CWBackPixel | CWBorderPixel | CWColormap; | 315 xswamask=CWBackPixel | CWBorderPixel | CWColormap; |
342 } else XSelectInput( mDisplay,vo_window,ExposureMask ); | 332 } else XSelectInput( mDisplay,vo_window,ExposureMask ); |
343 } | 333 } |
344 else | 334 else |
345 { | 335 { |
346 vo_window=XCreateWindow( mDisplay,mRootWin, | 336 vo_window=XCreateWindow( mDisplay,mRootWin, |
347 hint.x,hint.y, | 337 vo_dx,vo_dy, |
348 hint.width,hint.height, | 338 vo_dwidth,vo_dheight, |
349 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); | 339 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); |
350 | 340 |
351 vo_x11_classhint( mDisplay,vo_window,"x11" ); | 341 vo_x11_classhint( mDisplay,vo_window,"x11" ); |
352 vo_hidecursor(mDisplay,vo_window); | 342 vo_hidecursor(mDisplay,vo_window); |
343 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 ); | |
353 XSelectInput( mDisplay,vo_window,StructureNotifyMask ); | 344 XSelectInput( mDisplay,vo_window,StructureNotifyMask ); |
354 XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint ); | 345 XStoreName( mDisplay,vo_window,title ); |
355 XMapWindow( mDisplay,vo_window ); | 346 XMapWindow( mDisplay,vo_window ); |
356 if(WinID!=0) | 347 if(WinID!=0) |
357 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window ); | 348 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window ); |
358 XSelectInput( mDisplay,vo_window,NoEventMask ); | |
359 | 349 |
360 if ( fullscreen ) vo_x11_fullscreen(); | 350 if ( fullscreen ) vo_x11_fullscreen(); |
361 #ifdef HAVE_XINERAMA | 351 #ifdef HAVE_XINERAMA |
362 vo_x11_xinerama_move(mDisplay,vo_window); | 352 vo_x11_xinerama_move(mDisplay,vo_window); |
363 #endif | 353 #endif |
365 | 355 |
366 XFlush( mDisplay ); | 356 XFlush( mDisplay ); |
367 XSync( mDisplay,False ); | 357 XSync( mDisplay,False ); |
368 | 358 |
369 // we cannot grab mouse events on root window :( | 359 // we cannot grab mouse events on root window :( |
370 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | | 360 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask | |
371 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) ); | 361 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask)) ); |
372 | 362 |
373 #ifdef HAVE_XF86VM | 363 #ifdef HAVE_XF86VM |
374 if ( vm ) | 364 if ( vm ) |
375 { | 365 { |