From 20ca989333a3edc581a6c873f0303e2d032ae249 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 25 Feb 2015 21:52:03 +0100 Subject: [PATCH] Ignore more events while minimizing a client When minimizing a client, we temporarily ignore events for the client window (so that we don't get the UnmapNotify event that we are causing for the unmap) and for the root window (I don't actually know why, no "harmful" events should be caused...). However, we weren't ignoring events on the frame window itself. This commit fixes that oversight. The problem here is that the pointer could be inside the window that is being minimized. When we then unmap said window, the pointer will now be inside of the frame window and the X11 server will thus generate an EnterNotify. When we handle this event later on, we emit mouse::enter on the client and e.g. the default config then focuses this client, which undoes the minimization. This fixes a regression introduced in commit 3aeac3870ca4855 and fixes #92. Signed-off-by: Uli Schlachter --- objects/client.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/objects/client.c b/objects/client.c index aec85932..7332453a 100644 --- a/objects/client.c +++ b/objects/client.c @@ -867,12 +867,17 @@ client_set_minimized(lua_State *L, int cidx, bool s) xwindow_set_state(c->window, XCB_ICCCM_WM_STATE_ICONIC); uint32_t no_event[] = { 0 }; - const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK }; + const uint32_t client_select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK }; + const uint32_t frame_select_input_val[] = { FRAME_SELECT_INPUT_EVENT_MASK }; xcb_grab_server(globalconf.connection); xcb_change_window_attributes(globalconf.connection, globalconf.screen->root, XCB_CW_EVENT_MASK, no_event); + xcb_change_window_attributes(globalconf.connection, + c->frame_window, + XCB_CW_EVENT_MASK, + no_event); xcb_change_window_attributes(globalconf.connection, c->window, XCB_CW_EVENT_MASK, @@ -882,10 +887,14 @@ client_set_minimized(lua_State *L, int cidx, bool s) globalconf.screen->root, XCB_CW_EVENT_MASK, ROOT_WINDOW_EVENT_MASK); + xcb_change_window_attributes(globalconf.connection, + c->frame_window, + XCB_CW_EVENT_MASK, + frame_select_input_val); xcb_change_window_attributes(globalconf.connection, c->window, XCB_CW_EVENT_MASK, - select_input_val); + client_select_input_val); xcb_ungrab_server(globalconf.connection); } else