compositor: introduce weston_surface_geometry_dirty()
Instead of directly setting the dirty flag on weston_surface geometry,
use a function for that.
This allows us to hook into geometry dirtying in a following patch.
Also add comments to weston_surface fields, whose modification causes
transform state to become outdated.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/src/compositor.c b/src/compositor.c
index 5253de4..cc8ffe2 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -304,7 +304,7 @@
&surface->transform.position.link);
weston_matrix_init(&surface->transform.position.matrix);
pixman_region32_init(&surface->transform.boundingbox);
- surface->geometry.dirty = 1;
+ surface->transform.dirty = 1;
surface->pending.buffer_destroy_listener.notify =
surface_handle_pending_buffer_destroy;
@@ -657,10 +657,10 @@
WL_EXPORT void
weston_surface_update_transform(struct weston_surface *surface)
{
- if (!surface->geometry.dirty)
+ if (!surface->transform.dirty)
return;
- surface->geometry.dirty = 0;
+ surface->transform.dirty = 0;
weston_surface_damage_below(surface);
@@ -685,6 +685,12 @@
}
WL_EXPORT void
+weston_surface_geometry_dirty(struct weston_surface *surface)
+{
+ surface->transform.dirty = 1;
+}
+
+WL_EXPORT void
weston_surface_to_global_fixed(struct weston_surface *surface,
wl_fixed_t sx, wl_fixed_t sy,
wl_fixed_t *x, wl_fixed_t *y)
@@ -779,7 +785,7 @@
surface->geometry.y = y;
surface->geometry.width = width;
surface->geometry.height = height;
- surface->geometry.dirty = 1;
+ weston_surface_geometry_dirty(surface);
}
WL_EXPORT void
@@ -788,7 +794,7 @@
{
surface->geometry.x = x;
surface->geometry.y = y;
- surface->geometry.dirty = 1;
+ weston_surface_geometry_dirty(surface);
}
WL_EXPORT int
@@ -1441,7 +1447,7 @@
if (!pixman_region32_equal(&opaque, &surface->opaque)) {
pixman_region32_copy(&surface->opaque, &opaque);
- surface->geometry.dirty = 1;
+ weston_surface_geometry_dirty(surface);
}
pixman_region32_fini(&opaque);