From 8f4b95dccd41058da447251f133a6c953a596621 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 10 Jul 2011 20:18:06 +0200 Subject: [PATCH] x: change EnterNotify event mask only for mapped windows Saves a few ChangeWindowAttributes requests. --- src/x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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"); -- 2.39.5