subcompositor: Clean up subsurface_consider_map

check_parent was unecessary: it only served to skip a trivial check
and added more complexity than it was worth.
This commit is contained in:
Alexander Orzechowski 2022-12-12 00:00:50 -05:00
parent 84aee1d708
commit 5f264a7d6c

View file

@ -192,13 +192,12 @@ static const struct wl_subsurface_interface subsurface_implementation = {
* - The subsurface has a buffer * - The subsurface has a buffer
* - Its parent is mapped * - Its parent is mapped
*/ */
static void subsurface_consider_map(struct wlr_subsurface *subsurface, static void subsurface_consider_map(struct wlr_subsurface *subsurface) {
bool check_parent) {
if (subsurface->mapped || !wlr_surface_has_buffer(subsurface->surface)) { if (subsurface->mapped || !wlr_surface_has_buffer(subsurface->surface)) {
return; return;
} }
if (check_parent && wlr_surface_is_subsurface(subsurface->parent)) { if (wlr_surface_is_subsurface(subsurface->parent)) {
struct wlr_subsurface *parent = struct wlr_subsurface *parent =
wlr_subsurface_from_wlr_surface(subsurface->parent); wlr_subsurface_from_wlr_surface(subsurface->parent);
if (parent == NULL || !parent->mapped) { if (parent == NULL || !parent->mapped) {
@ -214,11 +213,11 @@ static void subsurface_consider_map(struct wlr_subsurface *subsurface,
struct wlr_subsurface *child; struct wlr_subsurface *child;
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below, wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below,
current.link) { current.link) {
subsurface_consider_map(child, false); subsurface_consider_map(child);
} }
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above, wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above,
current.link) { current.link) {
subsurface_consider_map(child, false); subsurface_consider_map(child);
} }
} }
@ -246,7 +245,7 @@ static void subsurface_role_commit(struct wlr_surface *surface) {
struct wlr_subsurface *subsurface = struct wlr_subsurface *subsurface =
wlr_subsurface_from_wlr_surface(surface); wlr_subsurface_from_wlr_surface(surface);
subsurface_consider_map(subsurface, true); subsurface_consider_map(subsurface);
} }
static void subsurface_role_precommit(struct wlr_surface *surface, static void subsurface_role_precommit(struct wlr_surface *surface,
@ -355,7 +354,7 @@ void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) {
subsurface->added = true; subsurface->added = true;
wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface, wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface,
subsurface); subsurface);
subsurface_consider_map(subsurface, true); subsurface_consider_map(subsurface);
} }
} }