mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
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.
This commit is contained in:
parent
f463ca669a
commit
df7d280343
1 changed files with 24 additions and 24 deletions
|
@ -508,6 +508,30 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface) {
|
||||||
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
||||||
subsurface->has_cache = false;
|
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) {
|
static void subsurface_commit(struct wlr_subsurface *subsurface) {
|
||||||
|
@ -1055,30 +1079,6 @@ static void subsurface_role_commit(struct wlr_surface *surface) {
|
||||||
return;
|
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);
|
subsurface_consider_map(subsurface, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue