x: change EnterNotify event mask only for mapped windows

Saves a few ChangeWindowAttributes requests.
This commit is contained in:
Michael Stapelberg 2011-07-10 20:18:06 +02:00
parent 37e0cf8346
commit 8f4b95dccd

10
src/x.c
View File

@ -729,7 +729,8 @@ void x_push_changes(Con *con) {
//DLOG("Disabling EnterNotify\n"); //DLOG("Disabling EnterNotify\n");
uint32_t values[1] = { XCB_NONE }; uint32_t values[1] = { XCB_NONE };
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) { 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"); //DLOG("Done, EnterNotify disabled\n");
bool order_changed = false; bool order_changed = false;
@ -752,11 +753,10 @@ void x_push_changes(Con *con) {
state->initial = false; state->initial = false;
} }
//DLOG("Re-enabling EnterNotify\n"); //DLOG("Re-enabling EnterNotify\n");
values[0] = FRAME_EVENT_MASK;
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) { CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
values[0] = FRAME_EVENT_MASK; if (state->mapped)
if (!state->mapped) xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
values[0] &= ~XCB_EVENT_MASK_ENTER_WINDOW;
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
} }
//DLOG("Done, EnterNotify re-enabled\n"); //DLOG("Done, EnterNotify re-enabled\n");