aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-01-10 16:55:14 +0100
committerSimon Ser <contact@emersion.fr>2021-01-15 10:18:56 +0100
commitaab43b3c76bb6c1cdbd89cbdffafe74e8530e70b (patch)
treedb8b67d576cf80ae01fb70dc53460632f7225d7d
parentf6f46b4ee21b8e8a044c4e7a02c114ec2b85dbaa (diff)
output-layout: stop listening to scale/transform events
Instead, listen to the commit event only.
-rw-r--r--types/wlr_output_layout.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index 498bdf7b..3286b8f8 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -20,8 +20,7 @@ struct wlr_output_layout_output_state {
bool auto_configured;
struct wl_listener mode;
- struct wl_listener scale;
- struct wl_listener transform;
+ struct wl_listener commit;
struct wl_listener output_destroy;
};
@@ -50,8 +49,7 @@ static void output_layout_output_destroy(
wlr_signal_emit_safe(&l_output->events.destroy, l_output);
wlr_output_destroy_global(l_output->output);
wl_list_remove(&l_output->state->mode.link);
- wl_list_remove(&l_output->state->scale.link);
- wl_list_remove(&l_output->state->transform.link);
+ wl_list_remove(&l_output->state->commit.link);
wl_list_remove(&l_output->state->output_destroy.link);
wl_list_remove(&l_output->link);
free(l_output->state);
@@ -146,16 +144,14 @@ static void handle_output_mode(struct wl_listener *listener, void *data) {
output_update_global(state->l_output->output);
}
-static void handle_output_scale(struct wl_listener *listener, void *data) {
+static void handle_output_commit(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
- wl_container_of(listener, state, scale);
- output_layout_reconfigure(state->layout);
-}
+ wl_container_of(listener, state, commit);
+ struct wlr_output_event_commit *event = data;
-static void handle_output_transform(struct wl_listener *listener, void *data) {
- struct wlr_output_layout_output_state *state =
- wl_container_of(listener, state, transform);
- output_layout_reconfigure(state->layout);
+ if (event->committed & (WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM)) {
+ output_layout_reconfigure(state->layout);
+ }
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {
@@ -186,10 +182,8 @@ static struct wlr_output_layout_output *output_layout_output_create(
wl_signal_add(&output->events.mode, &l_output->state->mode);
l_output->state->mode.notify = handle_output_mode;
- wl_signal_add(&output->events.scale, &l_output->state->scale);
- l_output->state->scale.notify = handle_output_scale;
- wl_signal_add(&output->events.transform, &l_output->state->transform);
- l_output->state->transform.notify = handle_output_transform;
+ wl_signal_add(&output->events.commit, &l_output->state->commit);
+ l_output->state->commit.notify = handle_output_commit;
wl_signal_add(&output->events.destroy, &l_output->state->output_destroy);
l_output->state->output_destroy.notify = handle_output_destroy;