]> git.sur5r.net Git - i3/i3/commitdiff
x: change EnterNotify event mask only for mapped windows
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jul 2011 18:18:06 +0000 (20:18 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jul 2011 18:18:06 +0000 (20:18 +0200)
Saves a few ChangeWindowAttributes requests.

src/x.c

diff --git a/src/x.c b/src/x.c
index 759a0be14dcc847c281465574c26ab318a1d6f28..45fd347f96c7e4ca895cc9392c96e4ada2e0a9f6 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -729,7 +729,8 @@ void x_push_changes(Con *con) {
     //DLOG("Disabling EnterNotify\n");
     uint32_t values[1] = { XCB_NONE };
     CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
-        xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
+        if (state->mapped)
+            xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
     }
     //DLOG("Done, EnterNotify disabled\n");
     bool order_changed = false;
@@ -752,11 +753,10 @@ void x_push_changes(Con *con) {
         state->initial = false;
     }
     //DLOG("Re-enabling EnterNotify\n");
+    values[0] = FRAME_EVENT_MASK;
     CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
-        values[0] = FRAME_EVENT_MASK;
-        if (!state->mapped)
-            values[0] &= ~XCB_EVENT_MASK_ENTER_WINDOW;
-        xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
+        if (state->mapped)
+            xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
     }
     //DLOG("Done, EnterNotify re-enabled\n");