aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <rpigott@berkeley.edu>2021-10-24 18:49:39 -0700
committerLibravatar Simon Ser <contact@emersion.fr>2021-12-17 14:39:48 +0100
commitebfe432ec3064094faebe0913b2d98932d590bfd (patch)
tree8a512564f0948e673c27e3bff0e8b5aa41bb7304
parentHandle border width and height on minimum floating sizes (diff)
downloadsway-ebfe432ec3064094faebe0913b2d98932d590bfd.tar.gz
sway-ebfe432ec3064094faebe0913b2d98932d590bfd.tar.zst
sway-ebfe432ec3064094faebe0913b2d98932d590bfd.zip
output: change output::destroy to output::disable
This changes output::destroy to output::disable and emits it only once when an output is disabled, instead of twice in succession.
-rw-r--r--include/sway/output.h2
-rw-r--r--sway/desktop/layer_shell.c2
-rw-r--r--sway/desktop/output.c8
-rw-r--r--sway/tree/output.c8
4 files changed, 10 insertions, 10 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index 5dfe0fff..26b9709f 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -48,7 +48,7 @@ struct sway_output {
48 struct wl_listener damage_frame; 48 struct wl_listener damage_frame;
49 49
50 struct { 50 struct {
51 struct wl_signal destroy; 51 struct wl_signal disable;
52 } events; 52 } events;
53 53
54 struct timespec last_presentation; 54 struct timespec last_presentation;
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index db78b59f..da59016d 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -664,7 +664,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
664 664
665 struct sway_output *output = layer_surface->output->data; 665 struct sway_output *output = layer_surface->output->data;
666 sway_layer->output_destroy.notify = handle_output_destroy; 666 sway_layer->output_destroy.notify = handle_output_destroy;
667 wl_signal_add(&output->events.destroy, &sway_layer->output_destroy); 667 wl_signal_add(&output->events.disable, &sway_layer->output_destroy);
668 668
669 wl_list_insert(&output->layers[layer_surface->pending.layer], 669 wl_list_insert(&output->layers[layer_surface->pending.layer],
670 &sway_layer->link); 670 &sway_layer->link);
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 3ae97e66..68f095c0 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -754,18 +754,22 @@ static void update_output_manager_config(struct sway_server *server) {
754static void handle_destroy(struct wl_listener *listener, void *data) { 754static void handle_destroy(struct wl_listener *listener, void *data) {
755 struct sway_output *output = wl_container_of(listener, output, destroy); 755 struct sway_output *output = wl_container_of(listener, output, destroy);
756 struct sway_server *server = output->server; 756 struct sway_server *server = output->server;
757 wl_signal_emit(&output->events.destroy, output); 757 output_begin_destroy(output);
758 758
759 if (output->enabled) { 759 if (output->enabled) {
760 output_disable(output); 760 output_disable(output);
761 } 761 }
762 output_begin_destroy(output); 762
763 wl_list_remove(&output->link);
763 764
764 wl_list_remove(&output->destroy.link); 765 wl_list_remove(&output->destroy.link);
765 wl_list_remove(&output->commit.link); 766 wl_list_remove(&output->commit.link);
766 wl_list_remove(&output->mode.link); 767 wl_list_remove(&output->mode.link);
767 wl_list_remove(&output->present.link); 768 wl_list_remove(&output->present.link);
768 769
770 output->wlr_output->data = NULL;
771 output->wlr_output = NULL;
772
769 transaction_commit_dirty(); 773 transaction_commit_dirty();
770 774
771 update_output_manager_config(server); 775 update_output_manager_config(server);
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 242e6fac..8eefcee3 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -95,7 +95,7 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
95 output->detected_subpixel = wlr_output->subpixel; 95 output->detected_subpixel = wlr_output->subpixel;
96 output->scale_filter = SCALE_FILTER_NEAREST; 96 output->scale_filter = SCALE_FILTER_NEAREST;
97 97
98 wl_signal_init(&output->events.destroy); 98 wl_signal_init(&output->events.disable);
99 99
100 wl_list_insert(&root->all_outputs, &output->link); 100 wl_list_insert(&root->all_outputs, &output->link);
101 101
@@ -262,7 +262,7 @@ void output_disable(struct sway_output *output) {
262 } 262 }
263 263
264 sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); 264 sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
265 wl_signal_emit(&output->events.destroy, output); 265 wl_signal_emit(&output->events.disable, output);
266 266
267 output_evacuate(output); 267 output_evacuate(output);
268 268
@@ -289,10 +289,6 @@ void output_begin_destroy(struct sway_output *output) {
289 289
290 output->node.destroying = true; 290 output->node.destroying = true;
291 node_set_dirty(&output->node); 291 node_set_dirty(&output->node);
292
293 wl_list_remove(&output->link);
294 output->wlr_output->data = NULL;
295 output->wlr_output = NULL;
296} 292}
297 293
298struct sway_output *output_from_wlr_output(struct wlr_output *output) { 294struct sway_output *output_from_wlr_output(struct wlr_output *output) {