aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r--sway/tree/output.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index a8ae30f7..ad8d2482 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -56,8 +56,8 @@ static void restore_workspaces(struct sway_output *output) {
56 } 56 }
57 57
58 // Saved workspaces 58 // Saved workspaces
59 while (root->noop_output->workspaces->length) { 59 while (root->fallback_output->workspaces->length) {
60 struct sway_workspace *ws = root->noop_output->workspaces->items[0]; 60 struct sway_workspace *ws = root->fallback_output->workspaces->items[0];
61 workspace_detach(ws); 61 workspace_detach(ws);
62 output_add_workspace(output, ws); 62 output_add_workspace(output, ws);
63 63
@@ -70,13 +70,13 @@ static void restore_workspaces(struct sway_output *output) {
70 // floater re-centered 70 // floater re-centered
71 for (int i = 0; i < ws->floating->length; i++) { 71 for (int i = 0; i < ws->floating->length; i++) {
72 struct sway_container *floater = ws->floating->items[i]; 72 struct sway_container *floater = ws->floating->items[i];
73 if (floater->width == 0 || floater->height == 0 || 73 if (floater->pending.width == 0 || floater->pending.height == 0 ||
74 floater->width > output->width || 74 floater->pending.width > output->width ||
75 floater->height > output->height || 75 floater->pending.height > output->height ||
76 floater->x > output->lx + output->width || 76 floater->pending.x > output->lx + output->width ||
77 floater->y > output->ly + output->height || 77 floater->pending.y > output->ly + output->height ||
78 floater->x + floater->width < output->lx || 78 floater->pending.x + floater->pending.width < output->lx ||
79 floater->y + floater->height < output->ly) { 79 floater->pending.y + floater->pending.height < output->ly) {
80 container_floating_resize_and_center(floater); 80 container_floating_resize_and_center(floater);
81 } 81 }
82 } 82 }
@@ -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
@@ -192,7 +192,7 @@ static void output_evacuate(struct sway_output *output) {
192 new_output = fallback_output; 192 new_output = fallback_output;
193 } 193 }
194 if (!new_output) { 194 if (!new_output) {
195 new_output = root->noop_output; 195 new_output = root->fallback_output;
196 } 196 }
197 197
198 struct sway_workspace *new_output_ws = 198 struct sway_workspace *new_output_ws =
@@ -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
@@ -286,13 +286,10 @@ void output_begin_destroy(struct sway_output *output) {
286 return; 286 return;
287 } 287 }
288 sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name); 288 sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name);
289 wl_signal_emit(&output->node.events.destroy, &output->node);
289 290
290 output->node.destroying = true; 291 output->node.destroying = true;
291 node_set_dirty(&output->node); 292 node_set_dirty(&output->node);
292
293 wl_list_remove(&output->link);
294 output->wlr_output->data = NULL;
295 output->wlr_output = NULL;
296} 293}
297 294
298struct sway_output *output_from_wlr_output(struct wlr_output *output) { 295struct sway_output *output_from_wlr_output(struct wlr_output *output) {