aboutsummaryrefslogtreecommitdiff
path: root/rootston/layer_shell.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-03 10:38:46 -0400
committeremersion <contact@emersion.fr>2018-04-03 10:38:46 -0400
commit58ac05c276c62c821735e77e15f7f502c82209aa (patch)
treee5712bbee8c665990ace1f7f3243aeec9cf9a65d /rootston/layer_shell.c
parent1cd7ff7d3ab1cb922e4064ee77db453064cccb5b (diff)
parent506acbdecd4436117729e4c40678645725ed2d1f (diff)
Merge branch 'master' into xwayland-dnd
Diffstat (limited to 'rootston/layer_shell.c')
-rw-r--r--rootston/layer_shell.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c
index d3a91659..1cd93b3c 100644
--- a/rootston/layer_shell.c
+++ b/rootston/layer_shell.c
@@ -192,6 +192,33 @@ void arrange_layers(struct roots_output *output) {
arrange_layer(output->wlr_output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
&usable_area, false);
+
+ // Find topmost keyboard interactive layer, if such a layer exists
+ uint32_t layers_above_shell[] = {
+ ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
+ ZWLR_LAYER_SHELL_V1_LAYER_TOP,
+ };
+ size_t nlayers = sizeof(layers_above_shell) / sizeof(layers_above_shell[0]);
+ struct roots_layer_surface *layer, *topmost = NULL;
+ for (size_t i = 0; i < nlayers; ++i) {
+ wl_list_for_each_reverse(layer,
+ &output->layers[layers_above_shell[i]], link) {
+ if (layer->layer_surface->current.keyboard_interactive) {
+ topmost = layer;
+ break;
+ }
+ }
+ if (topmost != NULL) {
+ break;
+ }
+ }
+
+ struct roots_input *input = output->desktop->server->input;
+ struct roots_seat *seat;
+ wl_list_for_each(seat, &input->seats, link) {
+ roots_seat_set_focus_layer(seat,
+ topmost ? topmost->layer_surface : NULL);
+ }
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {