[vlc-devel] [tomhaste at gmail.com: [Videolan-devel] Patch to fix x11 fullscreen and focus bugs.]

Jean-Baptiste Kempf jb at videolan.org
Sun Oct 12 15:45:48 CEST 2008


On Sat, Oct 11, 2008 at 09:24:50AM +0200, Jean-Baptiste Kempf wrote :
> Heres a patch from raster. Its commented well so have a read!

For me, this solves the VLC-fullscreen bug in e17.

I will apply if noone screams against it.


> Thanks,
> Toma

> --- ../orig/vlc-0.9.2/modules/video_output/x11/xcommon.c	2008-09-14 17:10:14.000000000 +1000
> +++ ./modules/video_output/x11/xcommon.c	2008-10-11 12:48:21.000000000 +1100
> @@ -2165,12 +2165,29 @@
>                          False, SubstructureRedirectMask,
>                          (XEvent*)&event );
>          }
> -
> +       
> +/* "bad fullscreen" - set this to 0. doing fullscreen this way is problematic
> + * for many reasons and basically fights with the window manager as the wm
> + * reparents AND vlc goes and reparents - multiple times. don't do it. it just
> + * makes it more inefficient and less "nice" to the x11 citizenry. this turns
> + * it off */
> +#define BADFS 0
> +/* explicitly asking for focus when you fullscreened is a little silly. the
> + * window manager SHOULD be handling this itself based on its own focus
> + * policies. if the user is "using" a given xinerama/xrandr screen or x11
> + * multihead screen AND vlc wants to fullscreen the wm should also focus it
> + * as its the only thing on the screen. if vlc fullscreens and its on
> + * "another monitor" to the one the user is using - this may "steal" the focus
> + * as really the wm should be deciding if, on fullscreening of a window
> + * the focus should go there or not, so let the wm decided */
> +#define APPFOCUS 0
>          /* Make sure the change is effective */
> +#if BADFS // RASTER: why do this? you already mapped the window in CreateWindow?
>          XReparentWindow( p_vout->p_sys->p_display,
>                           p_vout->p_sys->p_win->base_window,
>                           DefaultRootWindow( p_vout->p_sys->p_display ),
> -                         0, 0 );
> +                         -2, -2 );
> +#endif       
>  
>  #ifdef HAVE_XINERAMA
>          if( XineramaQueryExtension( p_vout->p_sys->p_display, &i_d1, &i_d2 ) &&
> @@ -2261,6 +2278,7 @@
>          EnablePixelDoubling( p_vout );
>  #endif
>  
> +#if APPFOCUS // RASTER: let the wm do focus policy
>          /* Activate the window (give it the focus) */
>          XClientMessageEvent event;
>  
> @@ -2282,6 +2300,7 @@
>                      DefaultRootWindow( p_vout->p_sys->p_display ),
>                      False, SubstructureRedirectMask,
>                      (XEvent*)&event );
> +#endif       
>      }
>      else
>      {
> @@ -2307,13 +2326,18 @@
>       * window has already been mapped because the XMapWindow() request
>       * has not necessarily been sent directly to our window (remember,
>       * the call is first redirected to the window manager) */
> +
> +#if BADFS // RASTER: this is silly... if we have already mapped before   
>      do
>      {
>          XWindowEvent( p_vout->p_sys->p_display,
>                        p_vout->p_sys->p_win->base_window,
>                        StructureNotifyMask, &xevent );
>      } while( xevent.type != MapNotify );
> -
> +#else
> +   XSync(p_vout->p_sys->p_display, False);
> +#endif
> +   
>      /* Be careful, this can generate a BadMatch error if the window is not
>       * already mapped by the server (see above) */
>      XSetInputFocus(p_vout->p_sys->p_display,

> _______________________________________________
> videolan-devel mailing list
> videolan-devel at videolan.org
> http://mailman.videolan.org/listinfo/videolan-devel


> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel


-- 
Best Regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/



More information about the vlc-devel mailing list