mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
scene: stricter assertions on reparent
For consistency with the rest of the scene-graph API, prevent detaching a subtree by giving NULL for the new parent, and don't allow ROOT nodes to be grafted into another tree.
This commit is contained in:
parent
d5263be355
commit
7ec9523ea3
1 changed files with 3 additions and 4 deletions
|
@ -135,6 +135,8 @@ void wlr_scene_node_place_below(struct wlr_scene_node *node,
|
||||||
|
|
||||||
void wlr_scene_node_reparent(struct wlr_scene_node *node,
|
void wlr_scene_node_reparent(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_node *new_parent) {
|
struct wlr_scene_node *new_parent) {
|
||||||
|
assert(node->type != WLR_SCENE_NODE_ROOT && new_parent != NULL);
|
||||||
|
|
||||||
if (node->parent == new_parent) {
|
if (node->parent == new_parent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -145,12 +147,9 @@ void wlr_scene_node_reparent(struct wlr_scene_node *node,
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_remove(&node->state.link);
|
wl_list_remove(&node->state.link);
|
||||||
|
|
||||||
node->parent = new_parent;
|
node->parent = new_parent;
|
||||||
if (new_parent != NULL) {
|
|
||||||
wl_list_insert(new_parent->state.children.prev, &node->state.link);
|
wl_list_insert(new_parent->state.children.prev, &node->state.link);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void scene_node_for_each_surface(struct wlr_scene_node *node,
|
static void scene_node_for_each_surface(struct wlr_scene_node *node,
|
||||||
int lx, int ly, wlr_surface_iterator_func_t user_iterator,
|
int lx, int ly, wlr_surface_iterator_func_t user_iterator,
|
||||||
|
|
Loading…
Reference in a new issue