From fba262b1133c0ee6da53864e976445695c047e04 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 12 Oct 2021 20:47:37 +0200 Subject: [PATCH] scene: fix place above/below if sibling == node Currently these functions remove the node from the scene if the sibling argument is the same node as the node. Making this case a noop is much more predictable behavior. --- types/scene/wlr_scene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 9ba283efac..a3c692c3e2 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -442,7 +442,7 @@ void wlr_scene_node_place_above(struct wlr_scene_node *node, struct wlr_scene_node *sibling) { assert(node->parent == sibling->parent); - if (node->state.link.prev == &sibling->state.link) { + if (node == sibling || node->state.link.prev == &sibling->state.link) { return; } @@ -457,7 +457,7 @@ void wlr_scene_node_place_below(struct wlr_scene_node *node, struct wlr_scene_node *sibling) { assert(node->parent == sibling->parent); - if (node->state.link.next == &sibling->state.link) { + if (node == sibling || node->state.link.next == &sibling->state.link) { return; }