diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-20 19:21:32 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-20 19:21:32 -0500 |
commit | 23e9f5dc350b8d1f399ffe2e5b761f21dc9c46a8 (patch) | |
tree | fad787e3238090e9d53c1a4580ee46e7a13c3edf | |
parent | rename new_input listener on input-manager (diff) | |
download | sway-23e9f5dc350b8d1f399ffe2e5b761f21dc9c46a8.tar.gz sway-23e9f5dc350b8d1f399ffe2e5b761f21dc9c46a8.tar.zst sway-23e9f5dc350b8d1f399ffe2e5b761f21dc9c46a8.zip |
use wl_container_of() in output destroy callback
-rw-r--r-- | sway/desktop/output.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 8e0daeea..63420d0c 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -219,23 +219,11 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
219 | } | 219 | } |
220 | 220 | ||
221 | static void handle_output_destroy(struct wl_listener *listener, void *data) { | 221 | static void handle_output_destroy(struct wl_listener *listener, void *data) { |
222 | struct sway_output *output = wl_container_of(listener, output, output_destroy); | ||
222 | struct wlr_output *wlr_output = data; | 223 | struct wlr_output *wlr_output = data; |
223 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | 224 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); |
224 | 225 | ||
225 | swayc_t *output_container = NULL; | 226 | destroy_output(output->swayc); |
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 | } | 227 | } |
240 | 228 | ||
241 | void handle_new_output(struct wl_listener *listener, void *data) { | 229 | void handle_new_output(struct wl_listener *listener, void *data) { |