[vlc-devel] [PATCH 2/2] xcb: set the window position after mapping the window

Felix Abecassis felix.abecassis at gmail.com
Fri Jan 31 14:22:52 CET 2014

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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 3514617..ce00bc5 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -325,6 +325,15 @@ 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 if the
+       user specified the coordinates. */
+    if (cfg->x >= 0)
+        xcb_configure_window (conn, window, XCB_CONFIG_WINDOW_X, &cfg->x);
+    if (cfg->y >= 0)
+        xcb_configure_window (conn, window, XCB_CONFIG_WINDOW_Y, &cfg->y);
     /* 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)

More information about the vlc-devel mailing list