From efd91555132069348e3efac03c91d9150197c10c Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sun, 5 Jun 2022 17:12:55 +0200 Subject: [PATCH] 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 --- include/common/scene-helpers.h | 1 + src/common/scene-helpers.c | 7 +++++++ src/debug.c | 12 ++++++++---- src/osd.c | 2 +- src/ssd/ssd_titlebar.c | 13 ++++++++++++- subprojects/wlroots.wrap | 2 +- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/include/common/scene-helpers.h b/include/common/scene-helpers.h index 60991975..a124d0a3 100644 --- a/include/common/scene-helpers.h +++ b/include/common/scene-helpers.h @@ -3,4 +3,5 @@ #include struct wlr_scene_rect *lab_wlr_scene_get_rect(struct wlr_scene_node *node); +struct wlr_scene_tree *lab_scene_tree_from_node(struct wlr_scene_node *node); struct wlr_surface *lab_wlr_surface_from_node(struct wlr_scene_node *node); diff --git a/src/common/scene-helpers.c b/src/common/scene-helpers.c index a320b4c3..ae1220bf 100644 --- a/src/common/scene-helpers.c +++ b/src/common/scene-helpers.c @@ -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) { diff --git a/src/debug.c b/src/debug.c index cf681820..5698664b 100644 --- a/src/debug.c +++ b/src/debug.c @@ -172,10 +172,14 @@ dump_tree(struct server *server, struct wlr_scene_node *node, printf("%*c%s\n", pos + 4 + INDENT_SIZE, ' ', ""); 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); + } } } diff --git a/src/osd.c b/src/osd.c index 11f03941..7cb0580a 100644 --- a/src/osd.c +++ b/src/osd.c @@ -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); } diff --git a/src/ssd/ssd_titlebar.c b/src/ssd/ssd_titlebar.c index e25238a4..80aed120 100644 --- a/src/ssd/ssd_titlebar.c +++ b/src/ssd/ssd_titlebar.c @@ -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; diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index a6bc1574..f7d5f53e 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://gitlab.freedesktop.org/wlroots/wlroots.git -revision = cb2dbc327e4d695c2a60a386e116a7dc20b29107 +revision = 71f8a48d380701de1e3331d53d470bd76f5f643b [provide] dependency_names = wlroots -- 2.52.0