aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-04 13:31:09 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-04 13:31:09 +1000
commit1206a6097711556b22418db5043dc7c22d8b9a3e (patch)
tree1e8bfcc2aca3834bb9885ce7ce8c3a1e6cdf8dd1
parentDon't set focus to NULL when clicking a surface which has no container (diff)
downloadsway-1206a6097711556b22418db5043dc7c22d8b9a3e.tar.gz
sway-1206a6097711556b22418db5043dc7c22d8b9a3e.tar.zst
sway-1206a6097711556b22418db5043dc7c22d8b9a3e.zip
Don't restore focus if unmapping surface wasn't focused
-rw-r--r--sway/desktop/xwayland.c17
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}