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

Felix Abecassis felix.abecassis at gmail.com
Wed Jan 29 12:26:31 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 | 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,
                                     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);
+
     /* 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)
-- 
1.8.3.2




More information about the vlc-devel mailing list