diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-04 11:30:26 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-04 11:30:26 +1000 |
commit | 74799937cf95205c2ff16da9dc7dcaea47ce7116 (patch) | |
tree | 90ec5fddd959a3b41acc4d9fcbcd7ef57f10d527 | |
parent | Merge pull request #2087 from RedSoxFan/output-subcommand (diff) | |
download | sway-74799937cf95205c2ff16da9dc7dcaea47ce7116.tar.gz sway-74799937cf95205c2ff16da9dc7dcaea47ce7116.tar.zst sway-74799937cf95205c2ff16da9dc7dcaea47ce7116.zip |
Restore focus when unmapping unmanaged xwayland surfaces
-rw-r--r-- | sway/desktop/xwayland.c | 12 |
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) { | |||
77 | desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true); | 77 | desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true); |
78 | wl_list_remove(&surface->link); | 78 | wl_list_remove(&surface->link); |
79 | wl_list_remove(&surface->commit.link); | 79 | wl_list_remove(&surface->commit.link); |
80 | |||
81 | if (!wlr_xwayland_surface_is_unmanaged(xsurface)) { | ||
82 | // Restore focus | ||
83 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
84 | struct sway_container *previous = | ||
85 | seat_get_focus_inactive(seat, &root_container); | ||
86 | if (previous) { | ||
87 | // Hack to get seat to re-focus the return value of get_focus | ||
88 | seat_set_focus(seat, previous->parent); | ||
89 | seat_set_focus(seat, previous); | ||
90 | } | ||
91 | } | ||
80 | } | 92 | } |
81 | 93 | ||
82 | static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { | 94 | static void unmanaged_handle_destroy(struct wl_listener *listener, void *data) { |