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.h b/src/compositor.h
index 3fe5b16..f3e54d9 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -370,8 +370,8 @@
* To add a transformation to a surface, create a struct weston_transform, and
* add it to the list surface->geometry.transformation_list. Whenever you
* change the list, anything under surface->geometry, or anything in the
- * weston_transforms linked into the list, you must set
- * surface->geometry.dirty = 1.
+ * weston_transforms linked into the list, you must call
+ * weston_surface_geometry_dirty().
*
* The order in the list defines the order of transformations. Let the list
* contain the transformation matrices M1, ..., Mn as head to tail. The
@@ -395,17 +395,17 @@
struct weston_compositor *compositor;
pixman_region32_t clip;
pixman_region32_t damage;
- pixman_region32_t opaque;
+ pixman_region32_t opaque; /* part of geometry, see below */
pixman_region32_t input;
struct wl_list link;
struct wl_list layer_link;
- float alpha;
+ float alpha; /* part of geometry, see below */
struct weston_plane *plane;
void *renderer_state;
/* Surface geometry state, mutable.
- * If you change anything, set dirty = 1.
+ * If you change anything, call weston_surface_geometry_dirty().
* That includes the transformations referenced from the list.
*/
struct {
@@ -414,14 +414,14 @@
/* struct weston_transform */
struct wl_list transformation_list;
-
- int dirty;
} geometry;
/* State derived from geometry state, read-only.
* This is updated by weston_surface_update_transform().
*/
struct {
+ int dirty;
+
pixman_region32_t boundingbox;
pixman_region32_t opaque;
@@ -500,6 +500,9 @@
weston_surface_update_transform(struct weston_surface *surface);
void
+weston_surface_geometry_dirty(struct weston_surface *surface);
+
+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);