[vlc-devel] [PATCH] xcb: set the window position after mapping the window instead of during creation

Rémi Denis-Courmont remi at remlab.net
Wed Jan 29 12:38:57 CET 2014


On Wed, 29 Jan 2014 12:26:31 +0100, Felix Abecassis
<felix.abecassis at gmail.com> wrote:
> With some configurations, setting the X/Y coordinates when creating
> the window with xcb_create_window does not work. Moving the window
> manually with xcb_configure_window after xcb_map_window solves the
> issue. Command line arguments --video-x and--video-y are now working
> when using xcb_window (e.g. with --no-embedded-video).
> ---
>  modules/video_output/xcb/window.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/modules/video_output/xcb/window.c
> b/modules/video_output/xcb/window.c
> index 5717dab..3752bb3 100644
> --- a/modules/video_output/xcb/window.c
> +++ b/modules/video_output/xcb/window.c
> @@ -248,7 +248,7 @@ static int Open (vout_window_t *wnd, const
> vout_window_cfg_t *cfg)
>  
>      xcb_window_t window = xcb_generate_id (conn);
>      ck = xcb_create_window_checked (conn, scr->root_depth, window,
>      scr->root,
> -                                    cfg->x, cfg->y, cfg->width,
> cfg->height, 0,
> +                                    0, 0, cfg->width, cfg->height, 0,

Why that? This will cause visual glitch when running without WM, and I
fail to see any benefit.

>                                      XCB_WINDOW_CLASS_INPUT_OUTPUT,
>                                      scr->root_visual, mask, values);
>      err = xcb_request_check (conn, ck);
> @@ -324,6 +324,12 @@ static int Open (vout_window_t *wnd, const
> vout_window_cfg_t *cfg)
>      /* Make the window visible */
>      xcb_map_window (conn, window);
>  
> +    /* For some WMs the X/Y coordinates are not taken into account
> +       when passed to xcb_create_window. As a workaround we must
> +       manually set the coordinates after mapping the window. */
> +    const uint32_t coords[] = { cfg->x, cfg->y };
> +    xcb_configure_window (conn, window, XCB_CONFIG_WINDOW_X |
> XCB_CONFIG_WINDOW_Y, coords);

Problem is, we should only do that when the coordinate where explicitly
requested. Otherwise, we should really let the WM decide on the window
position, rather than force it to the top left.

> +
>      /* Create the event thread. It will dequeue all events, so any
checked
>       * request from this thread must be completed at this point. */
>      if ((p_sys->keys != NULL)

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list