aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-21 09:12:49 +0100
committerIsaac Freund <mail@isaacfreund.com>2023-03-28 22:58:29 +0000
commite00c4cd7dc14862503513dc029aa4d3db1d70865 (patch)
tree59c5d5ffe9d1668af103acf8462eb058ba00540f
parent59d2743c0cc4bb77527449fccfe1fba03357457c (diff)
output-layer: cache current state
The will be used by the Wayland backend to figure out whether updating sub-surface position is necessary.
-rw-r--r--include/wlr/types/wlr_output_layer.h4
-rw-r--r--types/output/output.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/include/wlr/types/wlr_output_layer.h b/include/wlr/types/wlr_output_layer.h
index 1ba69c8f..72dc43d5 100644
--- a/include/wlr/types/wlr_output_layer.h
+++ b/include/wlr/types/wlr_output_layer.h
@@ -48,6 +48,10 @@ struct wlr_output_layer {
} events;
void *data;
+
+ // private state
+
+ int x, y;
};
/**
diff --git a/types/output/output.c b/types/output/output.c
index 6d331b93..b39f197c 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -842,11 +842,17 @@ bool wlr_output_commit_state(struct wlr_output *output,
}
if (pending.committed & WLR_OUTPUT_STATE_LAYERS) {
- // Commit layer ordering
for (size_t i = 0; i < pending.layers_len; i++) {
- struct wlr_output_layer *layer = pending.layers[i].layer;
+ struct wlr_output_layer_state *layer_state = &pending.layers[i];
+ struct wlr_output_layer *layer = layer_state->layer;
+
+ // Commit layer ordering
wl_list_remove(&layer->link);
wl_list_insert(output->layers.prev, &layer->link);
+
+ // Commit layer state
+ layer->x = layer_state->x;
+ layer->y = layer_state->y;
}
}