aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-02-20 19:21:32 -0500
committerTony Crisci <tony@dubstepdish.com>2018-02-20 19:21:32 -0500
commit23e9f5dc350b8d1f399ffe2e5b761f21dc9c46a8 (patch)
treefad787e3238090e9d53c1a4580ee46e7a13c3edf /sway/desktop/output.c
parent4b3aa59b8bfaa5d6136b54ba7f347f5d93fa210f (diff)
use wl_container_of() in output destroy callback
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c16
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) {
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {
+ struct sway_output *output = wl_container_of(listener, output, output_destroy);
struct wlr_output *wlr_output = data;
wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);
- swayc_t *output_container = NULL;
- for (int i = 0 ; i < root_container.children->length; ++i) {
- swayc_t *child = root_container.children->items[i];
- if (child->type == C_OUTPUT &&
- child->sway_output->wlr_output == wlr_output) {
- output_container = child;
- break;
- }
- }
- if (!output_container) {
- return;
- }
-
- destroy_output(output_container);
+ destroy_output(output->swayc);
}
void handle_new_output(struct wl_listener *listener, void *data) {