view: commonize sub-view logic in view_move_to_front/back()

The logic was the same for xdg-shell and xwayland views, so move it from
the view->impl layer out to the view_move_to_front/back() functions.

view->impl->move_to_front/back() still exist for now, in case we want to
add xdg/xwayland-specific logic in future, but they now move only one
view and not sub-views.
This commit is contained in:
John Lindgren 2023-10-20 21:34:29 -04:00 committed by Johan Malm
parent 048d22d473
commit 47e80a488e
5 changed files with 57 additions and 90 deletions

View file

@ -25,29 +25,6 @@ view_impl_move_to_back(struct view *view)
wlr_scene_node_lower_to_bottom(&view->scene_tree->node);
}
void
view_impl_move_sub_views(struct view *parent, enum z_direction z_direction)
{
assert(parent);
if (!parent->impl->append_children) {
return;
}
struct wl_array subviews;
wl_array_init(&subviews);
parent->impl->append_children(parent, &subviews);
struct view **view;
wl_array_for_each(view, &subviews) {
if (z_direction == LAB_TO_FRONT) {
view_impl_move_to_front(*view);
} else if (z_direction == LAB_TO_BACK) {
view_impl_move_to_back(*view);
}
}
wl_array_release(&subviews);
}
void
view_impl_map(struct view *view)
{