Mercurial > mplayer.hg
comparison libvo/vo_x11.c @ 6043:421781c5b128
fix some small bug and -rootwin
author | pontscho |
---|---|
date | Sat, 11 May 2002 14:57:41 +0000 |
parents | 4dc96c97ac07 |
children | a4705acc43e5 |
comparison
equal
deleted
inserted
replaced
6042:c0fb4f38c8a7 | 6043:421781c5b128 |
---|---|
247 unsigned int modeline_width, modeline_height; | 247 unsigned int modeline_width, modeline_height; |
248 static uint32_t vm_width; | 248 static uint32_t vm_width; |
249 static uint32_t vm_height; | 249 static uint32_t vm_height; |
250 #endif | 250 #endif |
251 | 251 |
252 | |
253 vo_mouse_autohide=1; | 252 vo_mouse_autohide=1; |
254 old_vo_dwidth=-1; | 253 old_vo_dwidth=-1; |
255 old_vo_dheight=-1; | 254 old_vo_dheight=-1; |
256 | 255 |
257 if (!title) | 256 if (!title) |
259 | 258 |
260 in_format=format; | 259 in_format=format; |
261 if(in_format==IMGFMT_I420 || in_format==IMGFMT_IYUV) in_format=IMGFMT_YV12; | 260 if(in_format==IMGFMT_I420 || in_format==IMGFMT_IYUV) in_format=IMGFMT_YV12; |
262 srcW= width; | 261 srcW= width; |
263 srcH= height; | 262 srcH= height; |
263 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; | |
264 vo_dwidth=width; vo_dheight=height; | 264 vo_dwidth=width; vo_dheight=height; |
265 | 265 |
266 if( flags&0x03 ) fullscreen = 1; | 266 if( flags&0x03 ) fullscreen = 1; |
267 if( flags&0x02 ) vm = 1; | 267 if( flags&0x02 ) vm = 1; |
268 if( flags&0x08 ) Flip_Flag = 1; | 268 if( flags&0x08 ) Flip_Flag = 1; |
288 #ifdef HAVE_NEW_GUI | 288 #ifdef HAVE_NEW_GUI |
289 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window | 289 if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window |
290 else | 290 else |
291 #endif | 291 #endif |
292 { | 292 { |
293 hint.x=0; | 293 hint.x=vo_dx; |
294 hint.y=0; | 294 hint.y=vo_dy; |
295 // if(zoomFlag){ | 295 hint.width=width; |
296 // hint.width=d_width; | 296 hint.height=height; |
297 // hint.height=d_height; | |
298 // }else{ | |
299 hint.width=width; | |
300 hint.height=height; | |
301 // } | |
302 | 297 |
303 #ifdef HAVE_XF86VM | 298 #ifdef HAVE_XF86VM |
304 if ( vm ) | 299 if ( vm ) |
305 { | 300 { |
306 if ((d_width==0) && (d_height==0)) | 301 if ((d_width==0) && (d_height==0)) |
311 hint.x=(vo_screenwidth-modeline_width)/2; | 306 hint.x=(vo_screenwidth-modeline_width)/2; |
312 hint.y=(vo_screenheight-modeline_height)/2; | 307 hint.y=(vo_screenheight-modeline_height)/2; |
313 hint.width=modeline_width; | 308 hint.width=modeline_width; |
314 hint.height=modeline_height; | 309 hint.height=modeline_height; |
315 } | 310 } |
316 // else | 311 #endif |
317 #endif | |
318 // if ( fullscreen ) | |
319 // { | |
320 // hint.width=vo_screenwidth; | |
321 // hint.height=vo_screenheight; | |
322 // } | |
323 hint.flags=PPosition | PSize; | 312 hint.flags=PPosition | PSize; |
324 | 313 |
325 bg=WhitePixel( mDisplay,mScreen ); | 314 bg=WhitePixel( mDisplay,mScreen ); |
326 fg=BlackPixel( mDisplay,mScreen ); | 315 fg=BlackPixel( mDisplay,mScreen ); |
327 vo_dwidth=hint.width; | 316 vo_dwidth=hint.width; |
342 xswamask|=CWOverrideRedirect; | 331 xswamask|=CWOverrideRedirect; |
343 } | 332 } |
344 #endif | 333 #endif |
345 | 334 |
346 if ( WinID>=0 ){ | 335 if ( WinID>=0 ){ |
347 vo_window = WinID ? ((Window)WinID) : RootWindow( mDisplay,mScreen ); | 336 vo_window = WinID ? ((Window)WinID) : mRootWin; |
348 XUnmapWindow( mDisplay,vo_window ); | 337 if ( WinID ) |
349 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); | 338 { |
339 XUnmapWindow( mDisplay,vo_window ); | |
340 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); | |
341 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); | |
342 } else XSelectInput( mDisplay,vo_window,ExposureMask ); | |
350 } | 343 } |
351 else | 344 else |
352 vo_window=XCreateWindow( mDisplay,RootWindow( mDisplay,mScreen ), | 345 { |
346 vo_window=XCreateWindow( mDisplay,mRootWin, | |
353 hint.x,hint.y, | 347 hint.x,hint.y, |
354 hint.width,hint.height, | 348 hint.width,hint.height, |
355 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); | 349 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa ); |
356 | 350 |
357 vo_x11_classhint( mDisplay,vo_window,"x11" ); | 351 vo_x11_classhint( mDisplay,vo_window,"x11" ); |
358 vo_hidecursor(mDisplay,vo_window); | 352 vo_hidecursor(mDisplay,vo_window); |
359 XSelectInput( mDisplay,vo_window,StructureNotifyMask ); | 353 XSelectInput( mDisplay,vo_window,StructureNotifyMask ); |
360 XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint ); | 354 XSetStandardProperties( mDisplay,vo_window,title,title,None,NULL,0,&hint ); |
361 XMapWindow( mDisplay,vo_window ); | 355 XMapWindow( mDisplay,vo_window ); |
362 if(WinID!=0) | 356 if(WinID!=0) |
363 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window ); | 357 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != vo_window ); |
364 XSelectInput( mDisplay,vo_window,NoEventMask ); | 358 XSelectInput( mDisplay,vo_window,NoEventMask ); |
359 | |
360 if ( fullscreen ) vo_x11_fullscreen(); | |
361 #ifdef HAVE_XINERAMA | |
362 vo_x11_xinerama_move(mDisplay,vo_window); | |
363 #endif | |
364 } | |
365 | |
365 XFlush( mDisplay ); | 366 XFlush( mDisplay ); |
366 XSync( mDisplay,False ); | 367 XSync( mDisplay,False ); |
367 | 368 |
368 // we cannot grab mouse events on root window :( | 369 // we cannot grab mouse events on root window :( |
369 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | | 370 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | |
379 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); | 380 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
380 } | 381 } |
381 #endif | 382 #endif |
382 } | 383 } |
383 | 384 |
384 if ( fullscreen ) vo_x11_fullscreen(); | 385 vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv ); |
385 #ifdef HAVE_XINERAMA | 386 getMyXImage(); |
386 vo_x11_xinerama_move(mDisplay,vo_window); | 387 |
387 #endif | 388 if ( !WinID ) |
388 | 389 { vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; } |
389 vo_gc=XCreateGC( mDisplay,vo_window,0L,&xgcv ); | |
390 getMyXImage(); | |
391 | 390 |
392 switch ((bpp=myximage->bits_per_pixel)){ | 391 switch ((bpp=myximage->bits_per_pixel)){ |
393 case 24: draw_alpha_fnc=draw_alpha_24; | 392 case 24: draw_alpha_fnc=draw_alpha_24; |
394 out_format= IMGFMT_BGR24; break; | 393 out_format= IMGFMT_BGR24; break; |
395 case 32: draw_alpha_fnc=draw_alpha_32; | 394 case 32: draw_alpha_fnc=draw_alpha_32; |