]> git.sur5r.net Git - i3/i3/commitdiff
add error check and log for xcb_create_window 2731/head
authorNathan Schulte <nmschulte@gmail.com>
Fri, 7 Apr 2017 14:59:24 +0000 (09:59 -0500)
committerNathan Schulte <nmschulte@gmail.com>
Fri, 7 Apr 2017 14:59:24 +0000 (09:59 -0500)
src/xcb.c

index 726d1e89087f2fe0063d6e18ca8fd8020096d83f..bdfb08bc4d9dd994bc75a7050fa8b06019993eed 100644 (file)
--- a/src/xcb.c
+++ b/src/xcb.c
@@ -28,16 +28,21 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims,
         visual = XCB_COPY_FROM_PARENT;
     }
 
-    xcb_create_window(conn,
-                      depth,
-                      result,                                  /* the window id */
-                      root,                                    /* parent == root */
-                      dims.x, dims.y, dims.width, dims.height, /* dimensions */
-                      0,                                       /* border = 0, we draw our own */
-                      window_class,
-                      visual,
-                      mask,
-                      values);
+    xcb_void_cookie_t gc_cookie = xcb_create_window(conn,
+                                                    depth,
+                                                    result,                                  /* the window id */
+                                                    root,                                    /* parent == root */
+                                                    dims.x, dims.y, dims.width, dims.height, /* dimensions */
+                                                    0,                                       /* border = 0, we draw our own */
+                                                    window_class,
+                                                    visual,
+                                                    mask,
+                                                    values);
+
+    xcb_generic_error_t *error = xcb_request_check(conn, gc_cookie);
+    if (error != NULL) {
+        ELOG("Could not create window. Error code: %d.\n", error->error_code);
+    }
 
     /* Set the cursor */
     if (xcursor_supported) {