]> git.sur5r.net Git - i3/i3lock/commitdiff
Flush xcb connection after opening fullscreen window (#74)
authormartin <martin.sandsmark@kde.org>
Wed, 25 May 2016 20:19:17 +0000 (22:19 +0200)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Wed, 25 May 2016 20:19:17 +0000 (22:19 +0200)
We need to ensure that the window handle is valid, i. e. the window is
actually created and accessible, before returning.

This is necessary because we immediately fork after returning, and the
child process opens its own X11 connection and expects the window handle
to be valid.

Fixes #46

xcb.c

diff --git a/xcb.c b/xcb.c
index f1a9a7680cbd7b2bcba89bbb9cc7ff6821ba5c17..3e8cd071c455954b1189fed6e4392ce3338f7140 100644 (file)
--- a/xcb.c
+++ b/xcb.c
@@ -10,6 +10,7 @@
 #include <xcb/xcb.h>
 #include <xcb/xcb_image.h>
 #include <xcb/xcb_atom.h>
+#include <xcb/xcb_aux.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
@@ -150,6 +151,9 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
     values[0] = XCB_STACK_MODE_ABOVE;
     xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
 
+    /* Ensure that the window is created and set up before returning */
+    xcb_aux_sync(conn);
+
     return win;
 }