aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-06-04 11:30:26 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-06-04 11:30:26 +1000
commit74799937cf95205c2ff16da9dc7dcaea47ce7116 (patch)
tree90ec5fddd959a3b41acc4d9fcbcd7ef57f10d527 /sway/desktop
parent0549fd027bee17d2ee904ccf7e6447a8f79d9f7f (diff)
Restore focus when unmapping unmanaged xwayland surfaces
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xwayland.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 75bfb7b2..55c42227 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -77,6 +77,18 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {
desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true);
wl_list_remove(&surface->link);
wl_list_remove(&surface->commit.link);
+
+ if (!wlr_xwayland_surface_is_unmanaged(xsurface)) {
+ // Restore focus
+ struct sway_seat *seat = input_manager_current_seat(input_manager);
+ struct sway_container *previous =
+ seat_get_focus_inactive(seat, &root_container);
+ if (previous) {
+ // Hack to get seat to re-focus the return value of get_focus
+ seat_set_focus(seat, previous->parent);
+ seat_set_focus(seat, previous);
+ }
+ }
}
static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) {