compositor: Track DIRTY_POS properly

For clients using old protocol versions, the WESTON_SURFACE_DIRTY_POS bit
currently gets set on any attachment. It should really only be set if
the attachment is non-zero.

Since it's possible to attach mulitple times, or to invoke
wl_surface.offset multiple times, let's allow clearing the bit so it
stays up to date with the state that will actually be used on commmit().

Currently, this is pointlessly pedantic, as we don't really do much with
the bit, but in a future commit I intend to use it to notice states that
may change visibility/occlusion status of a surface.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-09-05 15:18:08 -05:00 committed by Marius Vlad
parent eac3d78bc6
commit 439aea0188

View file

@ -4426,7 +4426,10 @@ surface_attach(struct wl_client *client,
return;
}
} else {
surface->pending.status |= WESTON_SURFACE_DIRTY_POS;
if (sx != 0 || sy != 0)
surface->pending.status |= WESTON_SURFACE_DIRTY_POS;
else
surface->pending.status &= ~WESTON_SURFACE_DIRTY_POS;
surface->pending.buf_offset = weston_coord_surface(sx, sy,
surface);
}
@ -4790,7 +4793,10 @@ surface_offset(struct wl_client *client,
return;
}
surface->pending.status |= WESTON_SURFACE_DIRTY_POS;
if (sx != 0 || sy != 0)
surface->pending.status |= WESTON_SURFACE_DIRTY_POS;
else
surface->pending.status &= ~WESTON_SURFACE_DIRTY_POS;
surface->pending.buf_offset = weston_coord_surface(sx, sy, surface);
}