diff --git a/include/desktop/output.h b/include/desktop/output.h index b36351c..bd280d5 100644 --- a/include/desktop/output.h +++ b/include/desktop/output.h @@ -15,9 +15,9 @@ struct kiwmi_output { struct kiwmi_desktop *desktop; struct wlr_output *wlr_output; struct wl_listener frame; + struct wl_listener commit; struct wl_listener destroy; struct wl_listener mode; - struct wl_listener commit; struct wl_list layers[4]; // struct kiwmi_layer_surface::link diff --git a/kiwmi/desktop/output.c b/kiwmi/desktop/output.c index 6116716..c4bfb9d 100644 --- a/kiwmi/desktop/output.c +++ b/kiwmi/desktop/output.c @@ -168,6 +168,19 @@ output_frame_notify(struct wl_listener *listener, void *data) wlr_output_commit(wlr_output); } +static void +output_commit_notify(struct wl_listener *listener, void *data) +{ + struct kiwmi_output *output = wl_container_of(listener, output, commit); + struct wlr_output_event_commit *event = data; + + if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) { + arrange_layers(output); + + wl_signal_emit(&output->events.resize, output); + } +} + static void output_destroy_notify(struct wl_listener *listener, void *UNUSED(data)) { @@ -195,19 +208,6 @@ output_mode_notify(struct wl_listener *listener, void *UNUSED(data)) wl_signal_emit(&output->events.resize, output); } -static void -output_commit_notify(struct wl_listener *listener, void *data) -{ - struct kiwmi_output *output = wl_container_of(listener, output, commit); - struct wlr_output_event_commit *event = data; - - arrange_layers(output); - - if (event->committed == WLR_OUTPUT_STATE_TRANSFORM) { - wl_signal_emit(&output->events.resize, output); - } -} - static struct kiwmi_output * output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop) { @@ -222,15 +222,15 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop) output->frame.notify = output_frame_notify; wl_signal_add(&wlr_output->events.frame, &output->frame); + output->commit.notify = output_commit_notify; + wl_signal_add(&wlr_output->events.commit, &output->commit); + output->destroy.notify = output_destroy_notify; wl_signal_add(&wlr_output->events.destroy, &output->destroy); output->mode.notify = output_mode_notify; wl_signal_add(&wlr_output->events.mode, &output->mode); - output->commit.notify = output_commit_notify; - wl_signal_add(&wlr_output->events.commit, &output->commit); - return output; }