diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-04 11:31:07 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-04 11:31:07 +1000 |
commit | 9253278328524e4f483a66aa54ed11fd8538ace8 (patch) | |
tree | 8a43d800d5a5ba840af923517bedc138b971f0da | |
parent | 74799937cf95205c2ff16da9dc7dcaea47ce7116 (diff) |
Restore focus when unmapping layer shell surfaces
-rw-r--r-- | sway/desktop/layer_shell.c | 5 | ||||
-rw-r--r-- | sway/input/seat.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index b60aa487..2d355b74 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -257,6 +257,11 @@ static void unmap(struct sway_layer_surface *sway_layer) { } output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, sway_layer->layer_surface->surface, true); + + struct sway_seat *seat = input_manager_current_seat(input_manager); + if (seat->focused_layer == sway_layer->layer_surface) { + seat_set_focus_layer(seat, NULL); + } } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/sway/input/seat.c b/sway/input/seat.c index 0e539b70..071ef020 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -658,7 +658,8 @@ void seat_set_focus_layer(struct sway_seat *seat, struct wlr_layer_surface *layer) { if (!layer && seat->focused_layer) { seat->focused_layer = NULL; - struct sway_container *previous = seat_get_focus(seat); + struct sway_container *previous = + seat_get_focus_inactive(seat, &root_container); if (previous) { wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous, container_type_to_str(previous->type), previous->name); |