diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 00949ba6b..9c14b3ff4 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -617,7 +617,8 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer, focus_lost = TRUE; } - xwl_seat_leave_ptr(xwl_seat, focus_lost); + if (xwl_screen->rootless) + xwl_seat_leave_ptr(xwl_seat, focus_lost); } static void @@ -1211,7 +1212,8 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, xwl_screen->serial = serial; - xwl_seat_leave_kbd(xwl_seat); + if (xwl_screen->rootless) + xwl_seat_leave_kbd(xwl_seat); } static void diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h index dae6445c2..2c7a8cef9 100644 --- a/hw/xwayland/xwayland-screen.h +++ b/hw/xwayland/xwayland-screen.h @@ -54,6 +54,7 @@ struct xwl_screen { int expecting_event; enum RootClipMode root_clip_mode; + Bool active; int rootless; xwl_glamor_mode_flags glamor; int present; diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 6774ba096..922b45ee9 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -795,6 +795,8 @@ xdg_toplevel_handle_configure(void *data, { struct xwl_window *xwl_window = data; struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + uint32_t *p; + Bool old_active = xwl_screen->active; /* Maintain our current size if no dimensions are requested */ if (width == 0 && height == 0) @@ -804,6 +806,20 @@ xdg_toplevel_handle_configure(void *data, /* This will be committed by the xdg_surface.configure handler */ xwl_window_maybe_resize(xwl_window, width, height); } + + xwl_screen->active = FALSE; + wl_array_for_each (p, states) { + uint32_t state = *p; + if (state == XDG_TOPLEVEL_STATE_ACTIVATED) { + xwl_screen->active = TRUE; + break; + } + } + + if (old_active != xwl_screen->active) { + if (!xwl_screen->active) + xwl_screen_lost_focus(xwl_screen); + } } static void