Mercurial > mplayer.hg
comparison libvo/vo_xv.c @ 6043:421781c5b128
fix some small bug and -rootwin
author | pontscho |
---|---|
date | Sat, 11 May 2002 14:57:41 +0000 |
parents | be9cd7d845c2 |
children | 891cff8aba60 |
comparison
equal
deleted
inserted
replaced
6042:c0fb4f38c8a7 | 6043:421781c5b128 |
---|---|
335 image_width = width; | 335 image_width = width; |
336 image_format=format; | 336 image_format=format; |
337 | 337 |
338 vo_mouse_autohide=1; | 338 vo_mouse_autohide=1; |
339 | 339 |
340 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; | |
340 vo_dwidth=d_width; vo_dheight=d_height; | 341 vo_dwidth=d_width; vo_dheight=d_height; |
341 // vo_fs=flags&1; | |
342 // if ( vo_fs ) | |
343 // { vo_old_width=d_width; vo_old_height=d_height; } | |
344 | 342 |
345 #ifdef HAVE_XF86VM | 343 #ifdef HAVE_XF86VM |
346 if( flags&0x02 ) vm = 1; | 344 if( flags&0x02 ) vm = 1; |
347 #endif | 345 #endif |
348 flip_flag=flags&8; | 346 flip_flag=flags&8; |
364 if(use_gui) | 362 if(use_gui) |
365 guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window | 363 guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window |
366 else | 364 else |
367 #endif | 365 #endif |
368 { | 366 { |
369 hint.x = 0; | 367 hint.x = vo_dx; |
370 hint.y = 0; | 368 hint.y = vo_dy; |
371 hint.width = d_width; | 369 hint.width = d_width; |
372 hint.height = d_height; | 370 hint.height = d_height; |
373 aspect(&d_width,&d_height,A_NOZOOM); | 371 aspect(&d_width,&d_height,A_NOZOOM); |
374 #ifdef HAVE_XF86VM | 372 #ifdef HAVE_XF86VM |
375 if ( vm ) | 373 if ( vm ) |
386 } | 384 } |
387 else | 385 else |
388 #endif | 386 #endif |
389 if ( vo_fs ) | 387 if ( vo_fs ) |
390 { | 388 { |
391 // hint.width=vo_screenwidth; | |
392 // hint.height=vo_screenheight; | |
393 #ifdef X11_FULLSCREEN | 389 #ifdef X11_FULLSCREEN |
394 /* this code replaces X11_FULLSCREEN hack in mplayer.c | 390 /* this code replaces X11_FULLSCREEN hack in mplayer.c |
395 * aspect() is available through aspect.h for all vos. | 391 * aspect() is available through aspect.h for all vos. |
396 * besides zooming should only be done with -zoom, | 392 * besides zooming should only be done with -zoom, |
397 * but I leave the old -fs behaviour so users don't get | 393 * but I leave the old -fs behaviour so users don't get |
414 xswa.background_pixel = 0; | 410 xswa.background_pixel = 0; |
415 xswa.border_pixel = 0; | 411 xswa.border_pixel = 0; |
416 xswamask = CWBackPixel | CWBorderPixel; | 412 xswamask = CWBackPixel | CWBorderPixel; |
417 | 413 |
418 if ( WinID>=0 ){ | 414 if ( WinID>=0 ){ |
419 vo_window = WinID ? ((Window)WinID) : RootWindow(mDisplay,mScreen); | 415 vo_window = WinID ? ((Window)WinID) : mRootWin; |
420 XUnmapWindow( mDisplay,vo_window ); | 416 if ( WinID ) |
421 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); | 417 { |
418 XUnmapWindow( mDisplay,vo_window ); | |
419 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); | |
420 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); | |
421 } else { drwX=vo_dx; drwY=vo_dy; } | |
422 } else | 422 } else |
423 | 423 { |
424 vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen), | 424 vo_window = XCreateWindow(mDisplay, mRootWin, |
425 hint.x, hint.y, hint.width, hint.height, | 425 hint.x, hint.y, hint.width, hint.height, |
426 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); | 426 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); |
427 | 427 |
428 vo_x11_classhint( mDisplay,vo_window,"xv" ); | 428 vo_x11_classhint( mDisplay,vo_window,"xv" ); |
429 vo_hidecursor(mDisplay,vo_window); | 429 vo_hidecursor(mDisplay,vo_window); |
430 | 430 |
431 XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask | | 431 XSelectInput(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask | |
432 ((WinID==0) ? 0 : (PointerMotionMask | 432 ((WinID==0) ? 0 : (PointerMotionMask |
433 #ifdef HAVE_NEW_INPUT | 433 #ifdef HAVE_NEW_INPUT |
434 | ButtonPressMask | ButtonReleaseMask | 434 | ButtonPressMask | ButtonReleaseMask |
435 #endif | 435 #endif |
436 )) | 436 ))); |
437 ); | 437 XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); |
438 XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); | 438 XSetWMNormalHints( mDisplay,vo_window,&hint ); |
439 XSetWMNormalHints( mDisplay,vo_window,&hint ); | 439 XMapWindow(mDisplay, vo_window); |
440 XMapWindow(mDisplay, vo_window); | 440 if ( flags&1 ) vo_x11_fullscreen(); |
441 if ( flags&1 ) vo_x11_fullscreen(); | |
442 #ifdef HAVE_XINERAMA | 441 #ifdef HAVE_XINERAMA |
443 vo_x11_xinerama_move(mDisplay,vo_window); | 442 vo_x11_xinerama_move(mDisplay,vo_window); |
444 #endif | 443 #endif |
445 vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); | 444 } |
446 XFlush(mDisplay); | 445 vo_gc = XCreateGC(mDisplay, vo_window, 0L, &xgcv); |
447 XSync(mDisplay, False); | 446 XFlush(mDisplay); |
447 XSync(mDisplay, False); | |
448 #ifdef HAVE_XF86VM | 448 #ifdef HAVE_XF86VM |
449 if ( vm ) | 449 if ( vm ) |
450 { | 450 { |
451 /* Grab the mouse pointer in our window */ | 451 /* Grab the mouse pointer in our window */ |
452 XGrabPointer(mDisplay, vo_window, True, 0, | 452 XGrabPointer(mDisplay, vo_window, True, 0, |
475 current_buf=0; | 475 current_buf=0; |
476 | 476 |
477 set_gamma_correction(); | 477 set_gamma_correction(); |
478 | 478 |
479 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); | 479 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); |
480 if ( vo_fs ) | 480 if ( ( flags&1 )&&( !WinID ) ) |
481 { | 481 { |
482 aspect(&vo_dwidth,&vo_dheight,A_ZOOM); | 482 aspect(&vo_dwidth,&vo_dheight,A_ZOOM); |
483 drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2; | 483 drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2; |
484 drwY=( vo_screenheight - (vo_dheight > vo_screenheight?vo_screenheight:vo_dheight) ) / 2; | 484 drwY=( vo_screenheight - (vo_dheight > vo_screenheight?vo_screenheight:vo_dheight) ) / 2; |
485 vo_dwidth=(vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth); | 485 vo_dwidth=(vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth); |
486 vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight); | 486 vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight); |
487 mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); | 487 mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
488 } | 488 } |
489 | 489 |
490 mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); | 490 mp_msg(MSGT_VO,MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
491 | 491 |
492 saver_off(mDisplay); // turning off screen saver | 492 saver_off(mDisplay); // turning off screen saver |
493 return 0; | 493 return 0; |
494 } | 494 } |