Chase wlroots: children are now only availabe in tree nodes

Chases wlroots 71f8a48d380701de1e3331d53d470bd76f5f643b
wlr_scene: Move children list from wlr_scene_node to wlr_scene_tree
This commit is contained in:
Consolatis 2022-06-05 17:12:55 +02:00 committed by Johan Malm
parent 08518513cc
commit efd9155513
6 changed files with 30 additions and 7 deletions

View file

@ -10,6 +10,13 @@ lab_wlr_scene_get_rect(struct wlr_scene_node *node)
return (struct wlr_scene_rect *)node;
}
struct wlr_scene_tree *
lab_scene_tree_from_node(struct wlr_scene_node *node)
{
assert(node->type == WLR_SCENE_NODE_TREE);
return (struct wlr_scene_tree *)node;
}
struct wlr_surface *
lab_wlr_surface_from_node(struct wlr_scene_node *node)
{

View file

@ -172,10 +172,14 @@ dump_tree(struct server *server, struct wlr_scene_node *node,
printf("%*c%s\n", pos + 4 + INDENT_SIZE, ' ', "<skipping children>");
return;
}
struct wlr_scene_node *child;
wl_list_for_each(child, &node->children, link) {
dump_tree(server, child, pos + INDENT_SIZE,
x + child->x, y + child->y);
if (node->type == WLR_SCENE_NODE_TREE) {
struct wlr_scene_node *child;
struct wlr_scene_tree *tree = lab_scene_tree_from_node(node);
wl_list_for_each(child, &tree->children, link) {
dump_tree(server, child, pos + INDENT_SIZE,
x + child->x, y + child->y);
}
}
}

View file

@ -96,7 +96,7 @@ static void
destroy_osd_nodes(struct output *output)
{
struct wlr_scene_node *child, *next;
struct wl_list *children = &output->osd_tree->node.children;
struct wl_list *children = &output->osd_tree->children;
wl_list_for_each_safe(child, next, children, link) {
wlr_scene_node_destroy(child);
}

View file

@ -288,13 +288,24 @@ ssd_button_hover_enable(struct view *view, enum ssd_part_type type)
struct ssd_sub_tree *subtree;
FOR_EACH_STATE(view, subtree) {
if (subtree->tree->node.enabled) {
/*
* TODO: This function makes too many magic assumptions:
* - It expects the returned part to be the tree for the button
* - It expects the last node in that tree to be the hover overlay
*
* Both assumptions are valid as long as ssd_parts.c isn't changing
* the way a button is created but this cries for introducing bugs
* in the future if the button creation process or ssd_get_part()
* lookup routine would ever change.
*/
part = ssd_get_part(&subtree->parts, type);
if (!part) {
wlr_log(WLR_ERROR, "hover enable failed to find button");
return NULL;
}
struct wlr_scene_node *child;
wl_list_for_each_reverse(child, &part->node->children, link) {
struct wlr_scene_tree *button = lab_scene_tree_from_node(part->node);
wl_list_for_each_reverse(child, &button->children, link) {
if (child->type == WLR_SCENE_NODE_RECT) {
wlr_scene_node_set_enabled(child, true);
return child;