mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
compositor: add wlr_surface_role.client_commit
This commit is contained in:
parent
d847516765
commit
7e1ae5548c
2 changed files with 14 additions and 0 deletions
|
@ -81,6 +81,15 @@ struct wlr_surface_role {
|
||||||
* For example, this applies to cursor surfaces.
|
* For example, this applies to cursor surfaces.
|
||||||
*/
|
*/
|
||||||
bool no_object;
|
bool no_object;
|
||||||
|
/**
|
||||||
|
* Called when the client sends the wl_surface.commit request. May be NULL.
|
||||||
|
* Typically used to check that the pending state is valid, and send
|
||||||
|
* protocol errors if not.
|
||||||
|
*
|
||||||
|
* If the role is represented by an object, this is only called if
|
||||||
|
* such object exists.
|
||||||
|
*/
|
||||||
|
void (*client_commit)(struct wlr_surface *surface);
|
||||||
/**
|
/**
|
||||||
* Called when a new surface state is committed. May be NULL.
|
* Called when a new surface state is committed. May be NULL.
|
||||||
*
|
*
|
||||||
|
|
|
@ -565,6 +565,11 @@ static void surface_handle_commit(struct wl_client *client,
|
||||||
struct wlr_surface *surface = wlr_surface_from_resource(resource);
|
struct wlr_surface *surface = wlr_surface_from_resource(resource);
|
||||||
surface_finalize_pending(surface);
|
surface_finalize_pending(surface);
|
||||||
|
|
||||||
|
if (surface->role != NULL && surface->role->client_commit != NULL &&
|
||||||
|
(surface->role_resource != NULL || surface->role->no_object)) {
|
||||||
|
surface->role->client_commit(surface);
|
||||||
|
}
|
||||||
|
|
||||||
wl_signal_emit_mutable(&surface->events.client_commit, NULL);
|
wl_signal_emit_mutable(&surface->events.client_commit, NULL);
|
||||||
|
|
||||||
if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) {
|
if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) {
|
||||||
|
|
Loading…
Reference in a new issue