mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-01 07:16:18 -04:00
compositor: add wlr_surface_synced commit hook
This commit is contained in:
parent
e3596abc9a
commit
c3224d4160
2 changed files with 14 additions and 0 deletions
|
|
@ -484,6 +484,8 @@ void wlr_surface_set_preferred_buffer_scale(struct wlr_surface *surface,
|
||||||
void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface,
|
void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface,
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
|
|
||||||
|
struct wlr_surface_synced;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation for struct wlr_surface_synced.
|
* Implementation for struct wlr_surface_synced.
|
||||||
*
|
*
|
||||||
|
|
@ -500,6 +502,11 @@ struct wlr_surface_synced_impl {
|
||||||
void (*finish_state)(void *state);
|
void (*finish_state)(void *state);
|
||||||
// Move a state. If NULL, memcpy() is used.
|
// Move a state. If NULL, memcpy() is used.
|
||||||
void (*move_state)(void *dst, void *src);
|
void (*move_state)(void *dst, void *src);
|
||||||
|
|
||||||
|
// Called when the state is committed. If NULL, this is a no-op.
|
||||||
|
// If an object is a surface role object which has state synchronized with
|
||||||
|
// the surface state, the role commit hook should be preferred over this.
|
||||||
|
void (*commit)(struct wlr_surface_synced *synced);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -552,6 +552,13 @@ static void surface_commit_state(struct wlr_surface *surface,
|
||||||
surface->pending.seq++;
|
surface->pending.seq++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_surface_synced *synced;
|
||||||
|
wl_list_for_each(synced, &surface->synced, link) {
|
||||||
|
if (synced->impl->commit) {
|
||||||
|
synced->impl->commit(synced);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (surface->role != NULL && surface->role->commit != NULL &&
|
if (surface->role != NULL && surface->role->commit != NULL &&
|
||||||
(surface->role_resource != NULL || surface->role->no_object)) {
|
(surface->role_resource != NULL || surface->role->no_object)) {
|
||||||
surface->role->commit(surface);
|
surface->role->commit(surface);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue