mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
subsurface: simplify and fix parent commit handling
This commit is contained in:
parent
818fc4a87b
commit
f463ca669a
1 changed files with 13 additions and 36 deletions
|
@ -400,6 +400,8 @@ static void surface_update_input_region(struct wlr_surface *surface) {
|
||||||
|
|
||||||
static void surface_state_init(struct wlr_surface_state *state);
|
static void surface_state_init(struct wlr_surface_state *state);
|
||||||
|
|
||||||
|
static void subsurface_parent_commit(struct wlr_subsurface *subsurface);
|
||||||
|
|
||||||
static void surface_cache_pending(struct wlr_surface *surface) {
|
static void surface_cache_pending(struct wlr_surface *surface) {
|
||||||
struct wlr_surface_state *cached = calloc(1, sizeof(*cached));
|
struct wlr_surface_state *cached = calloc(1, sizeof(*cached));
|
||||||
if (!cached) {
|
if (!cached) {
|
||||||
|
@ -452,6 +454,7 @@ static void surface_commit_state(struct wlr_surface *surface,
|
||||||
// TODO: damage all the subsurfaces
|
// TODO: damage all the subsurfaces
|
||||||
surface_damage_subsurfaces(subsurface);
|
surface_damage_subsurfaces(subsurface);
|
||||||
}
|
}
|
||||||
|
subsurface_parent_commit(subsurface);
|
||||||
}
|
}
|
||||||
wl_list_for_each_reverse(subsurface, &surface->pending.subsurfaces_below,
|
wl_list_for_each_reverse(subsurface, &surface->pending.subsurfaces_below,
|
||||||
pending.link) {
|
pending.link) {
|
||||||
|
@ -463,6 +466,7 @@ static void surface_commit_state(struct wlr_surface *surface,
|
||||||
// TODO: damage all the subsurfaces
|
// TODO: damage all the subsurfaces
|
||||||
surface_damage_subsurfaces(subsurface);
|
surface_damage_subsurfaces(subsurface);
|
||||||
}
|
}
|
||||||
|
subsurface_parent_commit(subsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're committing the pending state, bump the pending sequence number
|
// If we're committing the pending state, bump the pending sequence number
|
||||||
|
@ -497,28 +501,12 @@ static bool subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void subsurface_parent_commit(struct wlr_subsurface *subsurface) {
|
||||||
* Recursive function to commit the effectively synchronized children.
|
|
||||||
*/
|
|
||||||
static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
|
|
||||||
bool synchronized) {
|
|
||||||
struct wlr_surface *surface = subsurface->surface;
|
struct wlr_surface *surface = subsurface->surface;
|
||||||
if (synchronized || subsurface->synchronized) {
|
|
||||||
if (subsurface->has_cache) {
|
|
||||||
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
|
||||||
subsurface->has_cache = false;
|
|
||||||
subsurface->cached_seq = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_subsurface *subsurface;
|
if (subsurface->synchronized && subsurface->has_cache) {
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_below,
|
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
||||||
current.link) {
|
subsurface->has_cache = false;
|
||||||
subsurface_parent_commit(subsurface, true);
|
|
||||||
}
|
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_above,
|
|
||||||
current.link) {
|
|
||||||
subsurface_parent_commit(subsurface, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,13 +545,6 @@ static void surface_handle_commit(struct wl_client *client,
|
||||||
} else {
|
} else {
|
||||||
surface_commit_state(surface, &surface->pending);
|
surface_commit_state(surface, &surface->pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
|
|
||||||
subsurface_parent_commit(subsurface, false);
|
|
||||||
}
|
|
||||||
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
|
|
||||||
subsurface_parent_commit(subsurface, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_handle_set_buffer_transform(struct wl_client *client,
|
static void surface_handle_set_buffer_transform(struct wl_client *client,
|
||||||
|
@ -989,15 +970,11 @@ static void subsurface_handle_set_desync(struct wl_client *client,
|
||||||
if (subsurface->synchronized) {
|
if (subsurface->synchronized) {
|
||||||
subsurface->synchronized = false;
|
subsurface->synchronized = false;
|
||||||
|
|
||||||
if (!subsurface_is_synchronized(subsurface)) {
|
if (!subsurface_is_synchronized(subsurface) &&
|
||||||
if (subsurface->has_cache) {
|
subsurface->has_cache) {
|
||||||
wlr_surface_unlock_cached(subsurface->surface,
|
wlr_surface_unlock_cached(subsurface->surface,
|
||||||
subsurface->cached_seq);
|
subsurface->cached_seq);
|
||||||
subsurface->has_cache = false;
|
subsurface->has_cache = false;
|
||||||
subsurface->cached_seq = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
subsurface_parent_commit(subsurface, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue