diff options
author | Kirill Primak <vyivel@posteo.net> | 2021-12-03 23:15:55 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-12-09 18:26:56 +0000 |
commit | df7d28034325ae80fd4b1660e2c6d5f67dc30d67 (patch) | |
tree | 5d46f58f322f22342d047abba186d10626fb9646 | |
parent | f463ca669ac7ddc24a19b32aac33e457c93aaf61 (diff) |
subsurface: apply position change at the right moment
Subsurface position is considered to be a part of the parent surface's
state, therefore it should be modified when the parent is committed.
-rw-r--r-- | types/wlr_surface.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c index bef4300f..360e4dff 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -508,6 +508,30 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface) { wlr_surface_unlock_cached(surface, subsurface->cached_seq); subsurface->has_cache = false; } + + if (subsurface->current.x != subsurface->pending.x || + subsurface->current.y != subsurface->pending.y) { + // Subsurface has moved + int dx = subsurface->current.x - subsurface->pending.x; + int dy = subsurface->current.y - subsurface->pending.y; + + subsurface->current.x = subsurface->pending.x; + subsurface->current.y = subsurface->pending.y; + + if ((surface->current.transform & WL_OUTPUT_TRANSFORM_90) != 0) { + int tmp = dx; + dx = dy; + dy = tmp; + } + + pixman_region32_union_rect(&surface->buffer_damage, + &surface->buffer_damage, + dx * surface->previous.scale, dy * surface->previous.scale, + surface->previous.buffer_width, surface->previous.buffer_height); + pixman_region32_union_rect(&surface->buffer_damage, + &surface->buffer_damage, 0, 0, + surface->current.buffer_width, surface->current.buffer_height); + } } static void subsurface_commit(struct wlr_subsurface *subsurface) { @@ -1055,30 +1079,6 @@ static void subsurface_role_commit(struct wlr_surface *surface) { return; } - if (subsurface->current.x != subsurface->pending.x || - subsurface->current.y != subsurface->pending.y) { - // Subsurface has moved - int dx = subsurface->current.x - subsurface->pending.x; - int dy = subsurface->current.y - subsurface->pending.y; - - subsurface->current.x = subsurface->pending.x; - subsurface->current.y = subsurface->pending.y; - - if ((surface->current.transform & WL_OUTPUT_TRANSFORM_90) != 0) { - int tmp = dx; - dx = dy; - dy = tmp; - } - - pixman_region32_union_rect(&surface->buffer_damage, - &surface->buffer_damage, - dx * surface->previous.scale, dy * surface->previous.scale, - surface->previous.buffer_width, surface->previous.buffer_height); - pixman_region32_union_rect(&surface->buffer_damage, - &surface->buffer_damage, 0, 0, - surface->current.buffer_width, surface->current.buffer_height); - } - subsurface_consider_map(subsurface, true); } |