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
1 changed files with 5 additions and 5 deletions

View File

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