diff options
-rw-r--r-- | sway/desktop/xwayland.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 55c42227..6447b711 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -79,14 +79,17 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) { | |||
79 | wl_list_remove(&surface->commit.link); | 79 | wl_list_remove(&surface->commit.link); |
80 | 80 | ||
81 | if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { | 81 | if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { |
82 | // Restore focus | ||
83 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 82 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
84 | struct sway_container *previous = | 83 | if (seat->wlr_seat->keyboard_state.focused_surface == |
85 | seat_get_focus_inactive(seat, &root_container); | 84 | xsurface->surface) { |
86 | if (previous) { | 85 | // Restore focus |
87 | // Hack to get seat to re-focus the return value of get_focus | 86 | struct sway_container *previous = |
88 | seat_set_focus(seat, previous->parent); | 87 | seat_get_focus_inactive(seat, &root_container); |
89 | seat_set_focus(seat, previous); | 88 | if (previous) { |
89 | // Hack to get seat to re-focus the return value of get_focus | ||
90 | seat_set_focus(seat, previous->parent); | ||
91 | seat_set_focus(seat, previous); | ||
92 | } | ||
90 | } | 93 | } |
91 | } | 94 | } |
92 | } | 95 | } |