mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05: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,
 | 
			
		||||
		struct wlr_scene_node *new_parent) {
 | 
			
		||||
	assert(node->type != WLR_SCENE_NODE_ROOT && new_parent != NULL);
 | 
			
		||||
 | 
			
		||||
	if (node->parent == new_parent) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -145,11 +147,8 @@ void wlr_scene_node_reparent(struct wlr_scene_node *node,
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue