]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland-unmanaged: focus parent surface on unmap
authorJelle De Loecker <jelle@elevenways.be>
Mon, 30 May 2022 08:00:14 +0000 (10:00 +0200)
committerJohan Malm <jgm323@gmail.com>
Mon, 30 May 2022 15:14:32 +0000 (16:14 +0100)
Re-focus on parent surface if it is available

Fixes #352 relating to JetBrains and Intellij focus issues

src/xwayland-unmanaged.c

index 2c1ac9928ef345548dd9d4e8fdcb51ee0335b183..9e497e392a2bbb6d0252b2830775227d88f4e27a 100644 (file)
@@ -84,6 +84,17 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
 
        struct seat *seat = &unmanaged->server->seat;
        if (seat->seat->keyboard_state.focused_surface == xsurface->surface) {
+               /*
+                * Try to focus on parent surface
+                * This seems to fix JetBrains/Intellij window focus issues
+                */
+               if (xsurface->parent && xsurface->parent->surface
+                               && wlr_xwayland_or_surface_wants_focus(xsurface->parent)) {
+                       seat_focus_surface(seat, xsurface->parent->surface);
+                       return;
+               }
+
+               /* Try to focus on last created unmanaged xwayland surface */
                struct xwayland_unmanaged *u;
                struct wl_list *list = &unmanaged->server->unmanaged_surfaces;
                wl_list_for_each (u, list, link) {