From 664e30903c88679724ad656f935fe18b2953e820 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 17 Dec 2011 18:47:29 +0000 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Don=E2=80=99t=20change=20focus=20afte?= =?UTF-8?q?r=20(graphical)=20resizing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/x.h | 8 ++++++++ src/resize.c | 3 +++ src/x.c | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/include/x.h b/include/x.h index 2d41b437..afc1645c 100644 --- a/include/x.h +++ b/include/x.h @@ -117,4 +117,12 @@ void x_set_i3_atoms(); */ void x_set_warp_to(Rect *rect); +/** + * Applies the given mask to the event mask of every i3 window decoration X11 + * window. This is useful to disable EnterNotify while resizing so that focus + * is untouched. + * + */ +void x_mask_event_mask(uint32_t mask); + #endif diff --git a/src/resize.c b/src/resize.c index a4e4dfa0..a1897b6c 100644 --- a/src/resize.c +++ b/src/resize.c @@ -58,6 +58,9 @@ int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, Con *output = con_get_output(first); DLOG("x = %d, width = %d\n", output->rect.x, output->rect.width); + x_mask_event_mask(~XCB_EVENT_MASK_ENTER_WINDOW); + xcb_flush(conn); + uint32_t mask = 0; uint32_t values[2]; diff --git a/src/x.c b/src/x.c index 61824d58..e8bfaeb4 100644 --- a/src/x.c +++ b/src/x.c @@ -964,3 +964,19 @@ void x_set_warp_to(Rect *rect) { warp_to = rect; } + +/* + * Applies the given mask to the event mask of every i3 window decoration X11 + * window. This is useful to disable EnterNotify while resizing so that focus + * is untouched. + * + */ +void x_mask_event_mask(uint32_t mask) { + uint32_t values[] = { FRAME_EVENT_MASK & mask }; + + con_state *state; + CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) { + if (state->mapped) + xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values); + } +}