compositor: wrap cached lock seq in struct

This improves type safety: the struct wlr_surface_cached_lock value
can't be mixed with other integer values.
This commit is contained in:
Simon Ser 2023-12-22 10:07:04 +01:00
parent f3e1f7b2a7
commit 15b0adf59a
4 changed files with 20 additions and 13 deletions

View file

@ -381,6 +381,13 @@ void wlr_surface_get_effective_damage(struct wlr_surface *surface,
void wlr_surface_get_buffer_source_box(struct wlr_surface *surface,
struct wlr_fbox *box);
/**
* A lock preventing cached state from being applied.
*/
struct wlr_surface_cached_lock {
uint32_t seq;
};
/**
* Acquire a lock for the pending surface state.
*
@ -390,7 +397,7 @@ void wlr_surface_get_buffer_source_box(struct wlr_surface *surface,
*
* Returns a surface commit sequence number for the cached state.
*/
uint32_t wlr_surface_lock_pending(struct wlr_surface *surface);
struct wlr_surface_cached_lock wlr_surface_lock_pending(struct wlr_surface *surface);
/**
* Release a lock for a cached state.
@ -398,7 +405,7 @@ uint32_t wlr_surface_lock_pending(struct wlr_surface *surface);
* Callers should not assume that the cached state will immediately be
* committed. Another caller may still have an active lock.
*/
void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq);
void wlr_surface_unlock_cached(struct wlr_surface *surface, struct wlr_surface_cached_lock lock);
/**
* Set the preferred buffer scale for the surface.

View file

@ -32,7 +32,7 @@ struct wlr_subsurface {
struct wlr_subsurface_parent_state current, pending;
uint32_t cached_seq;
struct wlr_surface_cached_lock cached_lock;
bool has_cache;
bool synchronized;