]> git.sur5r.net Git - i3/i3/blobdiff - src/xcb.c
Only grab the mouse buttons that need to be grabbed. (#2290)
[i3/i3] / src / xcb.c
index 07f9281a58dba2f5284c58fe1aa256f8acf67eae..630c68f9cf6ccb847aa236a57378342948354e92 100644 (file)
--- a/src/xcb.c
+++ b/src/xcb.c
@@ -175,7 +175,8 @@ xcb_atom_t xcb_get_preferred_window_type(xcb_get_property_reply_t *reply) {
             atoms[i] == A__NET_WM_WINDOW_TYPE_MENU ||
             atoms[i] == A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
             atoms[i] == A__NET_WM_WINDOW_TYPE_POPUP_MENU ||
-            atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP) {
+            atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP ||
+            atoms[i] == A__NET_WM_WINDOW_TYPE_NOTIFICATION) {
             return atoms[i];
         }
     }
@@ -345,20 +346,12 @@ release_grab:
  * Grab the specified buttons on a window when managing it.
  *
  */
-void xcb_grab_buttons(xcb_connection_t *conn, xcb_window_t window, bool bind_scrollwheel) {
-    uint8_t buttons[3];
-    int num = 0;
-
-    if (bind_scrollwheel) {
-        buttons[num++] = XCB_BUTTON_INDEX_ANY;
-    } else {
-        buttons[num++] = XCB_BUTTON_INDEX_1;
-        buttons[num++] = XCB_BUTTON_INDEX_2;
-        buttons[num++] = XCB_BUTTON_INDEX_3;
-    }
-
-    for (int i = 0; i < num; i++) {
+void xcb_grab_buttons(xcb_connection_t *conn, xcb_window_t window, int *buttons) {
+    int i = 0;
+    while (buttons[i] > 0) {
         xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC,
                         XCB_GRAB_MODE_ASYNC, root, XCB_NONE, buttons[i], XCB_BUTTON_MASK_ANY);
+
+        i++;
     }
 }