From 0758a4fc9dac7a887517a40f31daaaf12540b7f5 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sat, 23 May 2020 10:41:20 -0400 Subject: xwayland: send focus change event unconditionally This fixes issues with (at least) dialogs in Jetbrains IDEs becoming unclickable if they ever lost focus (ref. swaywm/sway#5373). Prior to this change, since `xwm->focus_surface` would be set prior to `xwm_surface_activate` being called, the latter would short-circuit immediately and not notify the application of the focus change. --- xwayland/xwm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xwayland/xwm.c') diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 76175e5d..6846c76f 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1243,12 +1243,12 @@ static void xwm_handle_focus_in(struct wlr_xwm *xwm, // Because of that, we allow changing focus between surfaces belonging to the // same application. struct wlr_xwayland_surface *requested_focus = lookup_surface(xwm, ev->event); - if (!xwm->focus_surface || !requested_focus || - requested_focus->pid != xwm->focus_surface->pid) { - xwm_send_focus_window(xwm, xwm->focus_surface); - } else { + if (xwm->focus_surface && requested_focus && + requested_focus->pid == xwm->focus_surface->pid) { xwm->focus_surface = requested_focus; } + + xwm_send_focus_window(xwm, xwm->focus_surface); } static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) { -- cgit v1.2.3