diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 039aba25..8e0daeea 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -218,6 +218,26 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
218 | soutput->last_frame = now; | 218 | soutput->last_frame = now; |
219 | } | 219 | } |
220 | 220 | ||
221 | static void handle_output_destroy(struct wl_listener *listener, void *data) { | ||
222 | struct wlr_output *wlr_output = data; | ||
223 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | ||
224 | |||
225 | swayc_t *output_container = NULL; | ||
226 | for (int i = 0 ; i < root_container.children->length; ++i) { | ||
227 | swayc_t *child = root_container.children->items[i]; | ||
228 | if (child->type == C_OUTPUT && | ||
229 | child->sway_output->wlr_output == wlr_output) { | ||
230 | output_container = child; | ||
231 | break; | ||
232 | } | ||
233 | } | ||
234 | if (!output_container) { | ||
235 | return; | ||
236 | } | ||
237 | |||
238 | destroy_output(output_container); | ||
239 | } | ||
240 | |||
221 | void handle_new_output(struct wl_listener *listener, void *data) { | 241 | void handle_new_output(struct wl_listener *listener, void *data) { |
222 | struct sway_server *server = wl_container_of(listener, server, new_output); | 242 | struct sway_server *server = wl_container_of(listener, server, new_output); |
223 | struct wlr_output *wlr_output = data; | 243 | struct wlr_output *wlr_output = data; |
@@ -252,23 +272,3 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
252 | 272 | ||
253 | arrange_windows(&root_container, -1, -1); | 273 | arrange_windows(&root_container, -1, -1); |
254 | } | 274 | } |
255 | |||
256 | void handle_output_destroy(struct wl_listener *listener, void *data) { | ||
257 | struct wlr_output *wlr_output = data; | ||
258 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | ||
259 | |||
260 | swayc_t *output_container = NULL; | ||
261 | for (int i = 0 ; i < root_container.children->length; ++i) { | ||
262 | swayc_t *child = root_container.children->items[i]; | ||
263 | if (child->type == C_OUTPUT && | ||
264 | child->sway_output->wlr_output == wlr_output) { | ||
265 | output_container = child; | ||
266 | break; | ||
267 | } | ||
268 | } | ||
269 | if (!output_container) { | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | destroy_output(output_container); | ||
274 | } | ||