]> git.sur5r.net Git - i3/i3/blobdiff - src/manage.c
xcb: don’t use the _unchecked variant for requests which have a reply
[i3/i3] / src / manage.c
index e609501a46d324dda80eaa105472599754db7f1c..06088a82f7956cbead343a0f3ae5a6573e264ed7 100644 (file)
@@ -117,18 +117,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
         goto out;
     }
 
-    uint32_t mask = 0;
     uint32_t values[1];
 
     /* Set a temporary event mask for the new window, consisting only of
      * PropertyChange. We need to be notified of PropertyChanges because the
      * client can change its properties *after* we requested them but *before*
      * we actually reparented it and have set our final event mask. */
-    mask = XCB_CW_EVENT_MASK;
     values[0] = XCB_EVENT_MASK_PROPERTY_CHANGE;
-    xcb_change_window_attributes(conn, window, mask, values);
+    xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values);
 
-#define GET_PROPERTY(atom, len) xcb_get_property_unchecked(conn, false, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, len)
+#define GET_PROPERTY(atom, len) xcb_get_property(conn, false, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, len)
 
     wm_type_cookie = GET_PROPERTY(A__NET_WM_WINDOW_TYPE, UINT32_MAX);
     strut_cookie = GET_PROPERTY(A__NET_WM_STRUT_PARTIAL, UINT32_MAX);
@@ -285,6 +283,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
         want_floating = true;
     }
 
+    FREE(reply);
+
     if (cwindow->transient_for != XCB_NONE ||
         (cwindow->leader != XCB_NONE &&
          cwindow->leader != cwindow->id &&
@@ -326,15 +326,16 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
         goto out;
     }
 
-    mask = XCB_CW_EVENT_MASK;
-    values[0] = CHILD_EVENT_MASK;
-    xcb_change_window_attributes(conn, window, mask, values);
+    values[0] = CHILD_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW;
+    xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values);
     xcb_flush(conn);
 
     reply = xcb_get_property_reply(conn, state_cookie, NULL);
     if (xcb_reply_contains_atom(reply, A__NET_WM_STATE_FULLSCREEN))
         con_toggle_fullscreen(nc, CF_OUTPUT);
 
+    FREE(reply);
+
     /* Put the client inside the save set. Upon termination (whether killed or
      * normal exit does not matter) of the window manager, these clients will
      * be correctly reparented to their most closest living ancestor (=