aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-29 13:26:31 +0200
committerSimon Ser <contact@emersion.fr>2022-08-12 11:20:44 +0200
commit42d68d75324f33a1b65528ba6ea89ca9b624a201 (patch)
tree7f222aa7edbdfb58731bf2ba6de4d76ead0cb8e6
parent98cf38601fdf32fdd1d40ed4a92b1f31fb75d667 (diff)
surface: add WLR_SURFACE_STATE_OFFSET
This indicates whether the surface offset has changed.
-rw-r--r--include/wlr/types/wlr_compositor.h1
-rw-r--r--types/wlr_compositor.c12
2 files changed, 8 insertions, 5 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 034b075b..b0d1eed6 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -28,6 +28,7 @@ enum wlr_surface_state_field {
WLR_SURFACE_STATE_SCALE = 1 << 6,
WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7,
WLR_SURFACE_STATE_VIEWPORT = 1 << 8,
+ WLR_SURFACE_STATE_OFFSET = 1 << 9,
};
struct wlr_surface_state {
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index c1cdc3b0..f76e920a 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -53,7 +53,8 @@ static void surface_handle_attach(struct wl_client *client,
}
}
- surface->pending.committed |= WLR_SURFACE_STATE_BUFFER;
+ surface->pending.committed |=
+ WLR_SURFACE_STATE_BUFFER | WLR_SURFACE_STATE_OFFSET;
surface->pending.dx = dx;
surface->pending.dy = dy;
@@ -279,11 +280,14 @@ static void surface_state_move(struct wlr_surface_state *state,
if (next->committed & WLR_SURFACE_STATE_TRANSFORM) {
state->transform = next->transform;
}
- if (next->committed & WLR_SURFACE_STATE_BUFFER) {
+ if (next->committed & WLR_SURFACE_STATE_OFFSET) {
state->dx = next->dx;
state->dy = next->dy;
next->dx = next->dy = 0;
-
+ } else {
+ state->dx = state->dy = 0;
+ }
+ if (next->committed & WLR_SURFACE_STATE_BUFFER) {
wlr_buffer_unlock(state->buffer);
state->buffer = NULL;
if (next->buffer) {
@@ -291,8 +295,6 @@ static void surface_state_move(struct wlr_surface_state *state,
}
wlr_buffer_unlock(next->buffer);
next->buffer = NULL;
- } else {
- state->dx = state->dy = 0;
}
if (next->committed & WLR_SURFACE_STATE_SURFACE_DAMAGE) {
pixman_region32_copy(&state->surface_damage, &next->surface_damage);