aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/layer_shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/layer_shell.c')
-rw-r--r--sway/desktop/layer_shell.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index de1fe349..a7d96717 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -12,7 +12,6 @@
12#include "sway/layers.h" 12#include "sway/layers.h"
13#include "sway/output.h" 13#include "sway/output.h"
14#include "sway/server.h" 14#include "sway/server.h"
15#include "sway/tree/arrange.h"
16#include "sway/tree/layout.h" 15#include "sway/tree/layout.h"
17#include "log.h" 16#include "log.h"
18 17
@@ -174,9 +173,9 @@ void arrange_layers(struct sway_output *output) {
174 173
175 if (memcmp(&usable_area, &output->usable_area, 174 if (memcmp(&usable_area, &output->usable_area,
176 sizeof(struct wlr_box)) != 0) { 175 sizeof(struct wlr_box)) != 0) {
177 wlr_log(L_DEBUG, "Usable area changed, rearranging output"); 176 wlr_log(WLR_DEBUG, "Usable area changed, rearranging output");
178 memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box)); 177 memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box));
179 arrange_and_commit(output->swayc); 178 container_set_dirty(output->swayc);
180 } 179 }
181 180
182 // Arrange non-exlusive surfaces from top->bottom 181 // Arrange non-exlusive surfaces from top->bottom
@@ -269,7 +268,7 @@ static void unmap(struct sway_layer_surface *sway_layer) {
269static void handle_destroy(struct wl_listener *listener, void *data) { 268static void handle_destroy(struct wl_listener *listener, void *data) {
270 struct sway_layer_surface *sway_layer = 269 struct sway_layer_surface *sway_layer =
271 wl_container_of(listener, sway_layer, destroy); 270 wl_container_of(listener, sway_layer, destroy);
272 wlr_log(L_DEBUG, "Layer surface destroyed (%s)", 271 wlr_log(WLR_DEBUG, "Layer surface destroyed (%s)",
273 sway_layer->layer_surface->namespace); 272 sway_layer->layer_surface->namespace);
274 if (sway_layer->layer_surface->mapped) { 273 if (sway_layer->layer_surface->mapped) {
275 unmap(sway_layer); 274 unmap(sway_layer);
@@ -316,7 +315,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
316 struct wlr_layer_surface *layer_surface = data; 315 struct wlr_layer_surface *layer_surface = data;
317 struct sway_server *server = 316 struct sway_server *server =
318 wl_container_of(listener, server, layer_shell_surface); 317 wl_container_of(listener, server, layer_shell_surface);
319 wlr_log(L_DEBUG, "new layer surface: namespace %s layer %d anchor %d " 318 wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
320 "size %dx%d margin %d,%d,%d,%d", 319 "size %dx%d margin %d,%d,%d,%d",
321 layer_surface->namespace, layer_surface->layer, layer_surface->layer, 320 layer_surface->namespace, layer_surface->layer, layer_surface->layer,
322 layer_surface->client_pending.desired_width, 321 layer_surface->client_pending.desired_width,
@@ -326,12 +325,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
326 layer_surface->client_pending.margin.bottom, 325 layer_surface->client_pending.margin.bottom,
327 layer_surface->client_pending.margin.left); 326 layer_surface->client_pending.margin.left);
328 327
329 struct sway_layer_surface *sway_layer =
330 calloc(1, sizeof(struct sway_layer_surface));
331 if (!sway_layer) {
332 return;
333 }
334
335 if (!layer_surface->output) { 328 if (!layer_surface->output) {
336 // Assign last active output 329 // Assign last active output
337 struct sway_container *output = NULL; 330 struct sway_container *output = NULL;
@@ -353,6 +346,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
353 layer_surface->output = output->sway_output->wlr_output; 346 layer_surface->output = output->sway_output->wlr_output;
354 } 347 }
355 348
349 struct sway_layer_surface *sway_layer =
350 calloc(1, sizeof(struct sway_layer_surface));
351 if (!sway_layer) {
352 return;
353 }
354
356 sway_layer->surface_commit.notify = handle_surface_commit; 355 sway_layer->surface_commit.notify = handle_surface_commit;
357 wl_signal_add(&layer_surface->surface->events.commit, 356 wl_signal_add(&layer_surface->surface->events.commit,
358 &sway_layer->surface_commit); 357 &sway_layer->surface_commit);