diff options
author | 2017-12-13 21:47:37 +0100 | |
---|---|---|
committer | 2017-12-13 21:47:37 +0100 | |
commit | ec2fd6e5c0217ae58a03eca1e83d85f02c739643 (patch) | |
tree | ff2a84f28a9ea88f698d5099e430e665f801d1f7 /sway | |
parent | Update output containers on output layout change (diff) | |
download | sway-ec2fd6e5c0217ae58a03eca1e83d85f02c739643.tar.gz sway-ec2fd6e5c0217ae58a03eca1e83d85f02c739643.tar.zst sway-ec2fd6e5c0217ae58a03eca1e83d85f02c739643.zip |
Handle output remove
Diffstat (limited to 'sway')
-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; |