layers: handle top layer unmap/destroy better

On losing top layer focus, set focus on topmost mapped view.
This commit is contained in:
Johan Malm 2020-10-31 15:09:13 +00:00
parent 5d6143449f
commit a26fd5a75b
4 changed files with 47 additions and 2 deletions

View file

@ -124,3 +124,17 @@ seat_focus_surface(struct seat *seat, struct wlr_surface *surface)
wlr_seat_keyboard_notify_enter(seat->seat, surface, kb->keycodes,
kb->num_keycodes, &kb->modifiers);
}
void
seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer)
{
if (!layer) {
seat->focused_layer = NULL;
desktop_focus_topmost_mapped_view(seat->server);
return;
}
seat_focus_surface(seat, layer->surface);
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
seat->focused_layer = layer;
}
}