diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-22 19:27:34 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-23 11:15:07 +0200 |
commit | 420a669f214a948bb4e47de1cca7ea02014b5251 (patch) | |
tree | 9fab4e3f23b68a6b6b40bc89c8e22ac2615362ae /sway | |
parent | d41b0ef98fb760cd2aad5e75a35d8b08b0b1ce6a (diff) |
Updates per swaywm/wlroots#887
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/layer_shell.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index f841e5f1..f9a1a8bd 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -13,6 +13,7 @@ #include "sway/output.h" #include "sway/server.h" #include "sway/tree/layout.h" +#include "log.h" static void apply_exclusive(struct wlr_box *usable_area, uint32_t anchor, int32_t exclusive, @@ -316,6 +317,27 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { return; } + if (!layer_surface->output) { + // Assign last active output + struct sway_container *output = NULL; + struct sway_seat *seat = input_manager_get_default_seat(input_manager); + if (seat) { + output = seat_get_focus_inactive(seat, &root_container); + } + if (!output) { + if (!sway_assert(root_container.children->length, + "cannot auto-assign output for layer")) { + wlr_layer_surface_close(layer_surface); + return; + } + output = root_container.children->items[0]; + } + if (output->type != C_OUTPUT) { + output = container_parent(output, C_OUTPUT); + } + layer_surface->output = output->sway_output->wlr_output; + } + sway_layer->surface_commit.notify = handle_surface_commit; wl_signal_add(&layer_surface->surface->events.commit, &sway_layer->surface_commit); |