From: Michael Stapelberg Date: Sun, 10 Jul 2011 18:18:06 +0000 (+0200) Subject: x: change EnterNotify event mask only for mapped windows X-Git-Tag: tree-pr4~48 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8f4b95dccd41058da447251f133a6c953a596621;p=i3%2Fi3 x: change EnterNotify event mask only for mapped windows Saves a few ChangeWindowAttributes requests. --- diff --git a/src/x.c b/src/x.c index 759a0be1..45fd347f 100644 --- 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");