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);