aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index db21dc78..89b1a481 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -92,20 +92,15 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
92 wl_list_remove(&surface->commit.link); 92 wl_list_remove(&surface->commit.link);
93 93
94 struct sway_seat *seat = input_manager_current_seat(); 94 struct sway_seat *seat = input_manager_current_seat();
95 if (seat->wlr_seat->keyboard_state.focused_surface == 95 if (seat->wlr_seat->keyboard_state.focused_surface == xsurface->surface) {
96 xsurface->surface) { 96 // This simply returns focus to the parent surface if there's one available.
97 97 // This seems to handle JetBrains issues.
98 // Try to find another unmanaged surface from the same process to pass 98 if (xsurface->parent &&
99 // focus to. This is necessary because some applications (e.g. Jetbrains 99 wlr_surface_is_xwayland_surface(xsurface->parent->surface)) {
100 // IDEs) represent their multi-level menus as unmanaged surfaces, and 100 struct wlr_xwayland_surface *next_surface =
101 // when closing a submenu, the main menu should get input focus. 101 wlr_xwayland_surface_from_wlr_surface(xsurface->parent->surface);
102 struct sway_xwayland_unmanaged *current; 102 if (wlr_xwayland_or_surface_wants_focus(next_surface)) {
103 wl_list_for_each(current, &root->xwayland_unmanaged, link) { 103 seat_set_focus_surface(seat, xsurface->parent->surface, false);
104 struct wlr_xwayland_surface *prev_xsurface =
105 current->wlr_xwayland_surface;
106 if (prev_xsurface->pid == xsurface->pid &&
107 wlr_xwayland_or_surface_wants_focus(prev_xsurface)) {
108 seat_set_focus_surface(seat, prev_xsurface->surface, false);
109 return; 104 return;
110 } 105 }
111 } 106 }