]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Chase wlroots: children are now only availabe in tree nodes
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 5 Jun 2022 15:12:55 +0000 (17:12 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 7 Jun 2022 06:13:37 +0000 (07:13 +0100)
Chases wlroots 71f8a48d380701de1e3331d53d470bd76f5f643b
wlr_scene: Move children list from wlr_scene_node to wlr_scene_tree

include/common/scene-helpers.h
src/common/scene-helpers.c
src/debug.c
src/osd.c
src/ssd/ssd_titlebar.c
subprojects/wlroots.wrap

index 609919754b16d8db59c5f972183f4eed18276e27..a124d0a36ddfea5ad66c5c87b2d266ddab4ab9a5 100644 (file)
@@ -3,4 +3,5 @@
 #include <wlr/types/wlr_scene.h>
 
 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);
index a320b4c32e3ae6c82c9bc2584595a241424e8887..ae1220bffeae97788dbc74aa1bfad77627620115 100644 (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)
 {
index cf681820c4026bc8d1f02619c6120a59ce8c30de..5698664b6c3f833ad65c83ed9e35405732f8f6ee 100644 (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);
+               }
        }
 }
 
index 11f03941e3be24c6778a2ff133b9933718eab037..7cb0580ae26c5d78cc6ae6144c73cc06bb9bca5d 100644 (file)
--- 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);
        }
index e25238a45fad7e5e426f5b91537e5aeebdeb9c85..80aed120eaf4703480ad0b6448322c412f1ae814 100644 (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;
index a6bc15743eff24e1c6fcd8e952512fd438f4e7dc..f7d5f53e5b98c66de999bfe56bddf4141359f44c 100644 (file)
@@ -1,6 +1,6 @@
 [wrap-git]
 url = https://gitlab.freedesktop.org/wlroots/wlroots.git
-revision = cb2dbc327e4d695c2a60a386e116a7dc20b29107
+revision = 71f8a48d380701de1e3331d53d470bd76f5f643b
 
 [provide]
 dependency_names = wlroots