Avoid unnecessary layer arrangement

Plus restore alphabetical order
This commit is contained in:
tiosgz 2021-06-19 10:19:57 +00:00
parent 8df79486ef
commit 67900b3e9f
2 changed files with 17 additions and 17 deletions

View file

@ -15,9 +15,9 @@ struct kiwmi_output {
struct kiwmi_desktop *desktop; struct kiwmi_desktop *desktop;
struct wlr_output *wlr_output; struct wlr_output *wlr_output;
struct wl_listener frame; struct wl_listener frame;
struct wl_listener commit;
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener mode; struct wl_listener mode;
struct wl_listener commit;
struct wl_list layers[4]; // struct kiwmi_layer_surface::link struct wl_list layers[4]; // struct kiwmi_layer_surface::link

View file

@ -168,6 +168,19 @@ output_frame_notify(struct wl_listener *listener, void *data)
wlr_output_commit(wlr_output); 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 static void
output_destroy_notify(struct wl_listener *listener, void *UNUSED(data)) 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); 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 * static struct kiwmi_output *
output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop) 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; output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame); 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; output->destroy.notify = output_destroy_notify;
wl_signal_add(&wlr_output->events.destroy, &output->destroy); wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->mode.notify = output_mode_notify; output->mode.notify = output_mode_notify;
wl_signal_add(&wlr_output->events.mode, &output->mode); 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; return output;
} }