Identify topmost interactive layer post-arrange

This commit is contained in:
Drew DeVault 2018-04-02 18:47:40 -04:00
parent d3eaf6468c
commit 623a08e14f

View file

@ -187,6 +187,28 @@ void arrange_layers(struct sway_output *output) {
&usable_area, false);
arrange_layer(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 sway_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;
}
}
wlr_log(L_DEBUG, "topmost layer: %p", topmost);
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {