diff options
-rw-r--r-- | sway/desktop/output.c | 16 | ||||
-rw-r--r-- | sway/tree/layout.c | 6 |
2 files changed, 21 insertions, 1 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 2177ad74..ad843b31 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -123,5 +123,19 @@ void output_remove_notify(struct wl_listener *listener, void *data) { | |||
123 | struct sway_server *server = wl_container_of(listener, server, output_remove); | 123 | struct sway_server *server = wl_container_of(listener, server, output_remove); |
124 | struct wlr_output *wlr_output = data; | 124 | struct wlr_output *wlr_output = data; |
125 | sway_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | 125 | sway_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); |
126 | // TODO | 126 | |
127 | swayc_t *output_container = NULL; | ||
128 | for (int i = 0 ; i < root_container.children->length; ++i) { | ||
129 | swayc_t *child = root_container.children->items[i]; | ||
130 | if (child->type == C_OUTPUT && | ||
131 | child->sway_output->wlr_output == wlr_output) { | ||
132 | output_container = child; | ||
133 | break; | ||
134 | } | ||
135 | } | ||
136 | if (!output_container) { | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | destroy_output(output_container); | ||
127 | } | 141 | } |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 65382231..4bcf0e2f 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -23,10 +23,16 @@ static void output_layout_change_notify(struct wl_listener *listener, void *data | |||
23 | 23 | ||
24 | for (int i = 0 ; i < root_container.children->length; ++i) { | 24 | for (int i = 0 ; i < root_container.children->length; ++i) { |
25 | swayc_t *output_container = root_container.children->items[i]; | 25 | swayc_t *output_container = root_container.children->items[i]; |
26 | if (output_container->type != C_OUTPUT) { | ||
27 | continue; | ||
28 | } | ||
26 | struct sway_output *output = output_container->sway_output; | 29 | struct sway_output *output = output_container->sway_output; |
27 | 30 | ||
28 | struct wlr_box *output_box = wlr_output_layout_get_box( | 31 | struct wlr_box *output_box = wlr_output_layout_get_box( |
29 | root_container.sway_root->output_layout, output->wlr_output); | 32 | root_container.sway_root->output_layout, output->wlr_output); |
33 | if (!output_box) { | ||
34 | continue; | ||
35 | } | ||
30 | output_container->x = output_box->x; | 36 | output_container->x = output_box->x; |
31 | output_container->y = output_box->y; | 37 | output_container->y = output_box->y; |
32 | output_container->width = output_box->width; | 38 | output_container->width = output_box->width; |