From d0b3aed584ecb4cbaccb94e76ca5bcbc952075de Mon Sep 17 00:00:00 2001 From: Armin Preiml Date: Fri, 29 Jun 2018 16:22:19 +0200 Subject: [PATCH 1/2] do not send focus request to a window that doesn't allow this --- xwayland/xwm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 66a85d05..5a63ff9f 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -214,15 +214,24 @@ static void xwm_send_focus_window(struct wlr_xwm *xwm, XCB_INPUT_FOCUS_POINTER_ROOT, XCB_NONE, XCB_CURRENT_TIME); return; - } else if (xsurface->override_redirect) { + } + + if (xsurface->override_redirect) { return; } xcb_client_message_data_t message_data = { 0 }; message_data.data32[0] = xwm->atoms[WM_TAKE_FOCUS]; message_data.data32[1] = XCB_TIME_CURRENT_TIME; - xwm_send_wm_message(xsurface, &message_data, - XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT); + + if (xsurface->hints && !xsurface->hints->input) { + // if the surface doesn't allow the focus request, we will send him + // only the take focus event. It will get the focus by itself. + xwm_send_wm_message(xsurface, &message_data, XCB_EVENT_MASK_NO_EVENT); + return; + } + + xwm_send_wm_message(xsurface, &message_data, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT); xcb_set_input_focus(xwm->xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT, xsurface->window_id, XCB_CURRENT_TIME); From f93234d6f59a76052874c5c4d3a8025b4821f4cb Mon Sep 17 00:00:00 2001 From: Armin Preiml Date: Fri, 29 Jun 2018 19:25:20 +0200 Subject: [PATCH 2/2] fix: tabs instead of spaces --- xwayland/xwm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 5a63ff9f..54550d0c 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -216,7 +216,7 @@ static void xwm_send_focus_window(struct wlr_xwm *xwm, return; } - if (xsurface->override_redirect) { + if (xsurface->override_redirect) { return; } @@ -224,12 +224,12 @@ static void xwm_send_focus_window(struct wlr_xwm *xwm, message_data.data32[0] = xwm->atoms[WM_TAKE_FOCUS]; message_data.data32[1] = XCB_TIME_CURRENT_TIME; - if (xsurface->hints && !xsurface->hints->input) { - // if the surface doesn't allow the focus request, we will send him - // only the take focus event. It will get the focus by itself. - xwm_send_wm_message(xsurface, &message_data, XCB_EVENT_MASK_NO_EVENT); - return; - } + if (xsurface->hints && !xsurface->hints->input) { + // if the surface doesn't allow the focus request, we will send him + // only the take focus event. It will get the focus by itself. + xwm_send_wm_message(xsurface, &message_data, XCB_EVENT_MASK_NO_EVENT); + return; + } xwm_send_wm_message(xsurface, &message_data, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT);