aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 12:19:20 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 22:11:08 -0400
commita76829f3756d3df22fe46e6688374497de29c2e1 (patch)
tree2dc57796bf9975dacd3de8913cfe97d0c8fa981d
parentRespect user bar height preference (diff)
downloadsway-a76829f3756d3df22fe46e6688374497de29c2e1.tar.gz
sway-a76829f3756d3df22fe46e6688374497de29c2e1.tar.zst
sway-a76829f3756d3df22fe46e6688374497de29c2e1.zip
Some layer shell fixes
Based on the corresponding rootston changes
-rw-r--r--include/sway/layers.h2
-rw-r--r--include/sway/output.h1
-rw-r--r--sway/desktop/layer_shell.c22
-rw-r--r--sway/desktop/output.c8
4 files changed, 9 insertions, 24 deletions
diff --git a/include/sway/layers.h b/include/sway/layers.h
index 22054be1..ee47c5ad 100644
--- a/include/sway/layers.h
+++ b/include/sway/layers.h
@@ -14,8 +14,6 @@ struct sway_layer_surface {
14 struct wl_listener unmap; 14 struct wl_listener unmap;
15 struct wl_listener surface_commit; 15 struct wl_listener surface_commit;
16 struct wl_listener output_destroy; 16 struct wl_listener output_destroy;
17 struct wl_listener output_mode;
18 struct wl_listener output_transform;
19 17
20 bool configured; 18 bool configured;
21 struct wlr_box geo; 19 struct wlr_box geo;
diff --git a/include/sway/output.h b/include/sway/output.h
index f899230f..6fb79987 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -21,6 +21,7 @@ struct sway_output {
21 struct wl_listener frame; 21 struct wl_listener frame;
22 struct wl_listener destroy; 22 struct wl_listener destroy;
23 struct wl_listener mode; 23 struct wl_listener mode;
24 struct wl_listener transform;
24 25
25 pid_t bg_pid; 26 pid_t bg_pid;
26}; 27};
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index bd62f84a..31679fb2 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -193,22 +193,10 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) {
193 struct sway_layer_surface *sway_layer = 193 struct sway_layer_surface *sway_layer =
194 wl_container_of(listener, sway_layer, output_destroy); 194 wl_container_of(listener, sway_layer, output_destroy);
195 wl_list_remove(&sway_layer->output_destroy.link); 195 wl_list_remove(&sway_layer->output_destroy.link);
196 wl_list_remove(&sway_layer->output_mode.link);
197 wl_list_remove(&sway_layer->output_transform.link);
198 sway_layer->layer_surface->output = NULL; 196 sway_layer->layer_surface->output = NULL;
199 wlr_layer_surface_close(sway_layer->layer_surface); 197 wlr_layer_surface_close(sway_layer->layer_surface);
200} 198}
201 199
202static void handle_output_mode(struct wl_listener *listener, void *data) {
203 struct wlr_output *output = data;
204 arrange_layers((struct sway_output *)output->data);
205}
206
207static void handle_output_transform(struct wl_listener *listener, void *data) {
208 struct wlr_output *output = data;
209 arrange_layers((struct sway_output *)output->data);
210}
211
212static void handle_surface_commit(struct wl_listener *listener, void *data) { 200static void handle_surface_commit(struct wl_listener *listener, void *data) {
213 struct sway_layer_surface *layer = 201 struct sway_layer_surface *layer =
214 wl_container_of(listener, layer, surface_commit); 202 wl_container_of(listener, layer, surface_commit);
@@ -243,8 +231,6 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
243 wl_list_remove(&sway_layer->surface_commit.link); 231 wl_list_remove(&sway_layer->surface_commit.link);
244 if (sway_layer->layer_surface->output != NULL) { 232 if (sway_layer->layer_surface->output != NULL) {
245 wl_list_remove(&sway_layer->output_destroy.link); 233 wl_list_remove(&sway_layer->output_destroy.link);
246 wl_list_remove(&sway_layer->output_mode.link);
247 wl_list_remove(&sway_layer->output_transform.link);
248 } 234 }
249 struct sway_output *output = sway_layer->layer_surface->output->data; 235 struct sway_output *output = sway_layer->layer_surface->output->data;
250 arrange_layers(output); 236 arrange_layers(output);
@@ -289,14 +275,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
289 wl_signal_add(&layer_surface->output->events.destroy, 275 wl_signal_add(&layer_surface->output->events.destroy,
290 &sway_layer->output_destroy); 276 &sway_layer->output_destroy);
291 277
292 sway_layer->output_mode.notify = handle_output_mode;
293 wl_signal_add(&layer_surface->output->events.mode,
294 &sway_layer->output_mode);
295
296 sway_layer->output_transform.notify = handle_output_transform;
297 wl_signal_add(&layer_surface->output->events.transform,
298 &sway_layer->output_transform);
299
300 sway_layer->destroy.notify = handle_destroy; 278 sway_layer->destroy.notify = handle_destroy;
301 wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy); 279 wl_signal_add(&layer_surface->events.destroy, &sway_layer->destroy);
302 sway_layer->map.notify = handle_map; 280 sway_layer->map.notify = handle_map;
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index b8253ace..30b23a18 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -268,6 +268,12 @@ static void handle_output_mode(struct wl_listener *listener, void *data) {
268 arrange_windows(output->swayc, -1, -1); 268 arrange_windows(output->swayc, -1, -1);
269} 269}
270 270
271static void handle_output_transform(struct wl_listener *listener, void *data) {
272 struct sway_output *output = wl_container_of(listener, output, transform);
273 arrange_layers(output);
274 arrange_windows(output->swayc, -1, -1);
275}
276
271void handle_new_output(struct wl_listener *listener, void *data) { 277void handle_new_output(struct wl_listener *listener, void *data) {
272 struct sway_server *server = wl_container_of(listener, server, new_output); 278 struct sway_server *server = wl_container_of(listener, server, new_output);
273 struct wlr_output *wlr_output = data; 279 struct wlr_output *wlr_output = data;
@@ -306,6 +312,8 @@ void handle_new_output(struct wl_listener *listener, void *data) {
306 output->destroy.notify = handle_output_destroy; 312 output->destroy.notify = handle_output_destroy;
307 wl_signal_add(&wlr_output->events.mode, &output->mode); 313 wl_signal_add(&wlr_output->events.mode, &output->mode);
308 output->mode.notify = handle_output_mode; 314 output->mode.notify = handle_output_mode;
315 wl_signal_add(&wlr_output->events.transform, &output->transform);
316 output->transform.notify = handle_output_transform;
309 317
310 arrange_layers(output); 318 arrange_layers(output);
311 arrange_windows(&root_container, -1, -1); 319 arrange_windows(&root_container, -1, -1);