aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_scene.h5
-rw-r--r--types/wlr_scene.c14
2 files changed, 19 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index 8a327262..a489d6af 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -91,6 +91,11 @@ void wlr_scene_node_place_above(struct wlr_scene_node *node,
void wlr_scene_node_place_below(struct wlr_scene_node *node,
struct wlr_scene_node *sibling);
/**
+ * Move the node to another location in the tree.
+ */
+void wlr_scene_node_reparent(struct wlr_scene_node *node,
+ struct wlr_scene_node *new_parent);
+/**
* Call `iterator` on each surface in the scene-graph, with the surface's
* position in layout coordinates. The function is called from root to leaves
* (in rendering order).
diff --git a/types/wlr_scene.c b/types/wlr_scene.c
index 7e8c332b..99b8076a 100644
--- a/types/wlr_scene.c
+++ b/types/wlr_scene.c
@@ -133,6 +133,20 @@ void wlr_scene_node_place_below(struct wlr_scene_node *node,
wl_list_insert(sibling->state.link.prev, &node->state.link);
}
+void wlr_scene_node_reparent(struct wlr_scene_node *node,
+ struct wlr_scene_node *new_parent) {
+ if (node->parent == new_parent) {
+ return;
+ }
+
+ wl_list_remove(&node->state.link);
+
+ node->parent = new_parent;
+ if (new_parent != NULL) {
+ wl_list_insert(new_parent->state.children.prev, &node->state.link);
+ }
+}
+
static void scene_node_for_each_surface(struct wlr_scene_node *node,
int lx, int ly, wlr_surface_iterator_func_t user_iterator,
void *user_data) {