mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xdg-shell, xdg-shell-v6: don't emit unmap if surface is unmapped
Some clients create an xdg_surface, then create an xdg_toplevel, but don't map it and destroy it right after. The xdg_surface ends up in a state where it isn't mapped but role-specific resources have been allocated. xdg_surface_unmap needs to free these resources without emitting the unmap signal.
This commit is contained in:
		
							parent
							
								
									ff2e08aa74
								
							
						
					
					
						commit
						731ee24089
					
				
					 2 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -173,7 +173,9 @@ static void xdg_surface_unmap(struct wlr_xdg_surface *surface) {
 | 
				
			||||||
	assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
 | 
						assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: probably need to ungrab before this event
 | 
						// TODO: probably need to ungrab before this event
 | 
				
			||||||
 | 
						if (surface->mapped) {
 | 
				
			||||||
		wlr_signal_emit_safe(&surface->events.unmap, surface);
 | 
							wlr_signal_emit_safe(&surface->events.unmap, surface);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
 | 
						if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
 | 
				
			||||||
		wl_resource_set_user_data(surface->toplevel->resource, NULL);
 | 
							wl_resource_set_user_data(surface->toplevel->resource, NULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,7 +173,9 @@ static void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) {
 | 
				
			||||||
	assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
 | 
						assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: probably need to ungrab before this event
 | 
						// TODO: probably need to ungrab before this event
 | 
				
			||||||
 | 
						if (surface->mapped) {
 | 
				
			||||||
		wlr_signal_emit_safe(&surface->events.unmap, surface);
 | 
							wlr_signal_emit_safe(&surface->events.unmap, surface);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
 | 
						if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
 | 
				
			||||||
		wl_resource_set_user_data(surface->toplevel->resource, NULL);
 | 
							wl_resource_set_user_data(surface->toplevel->resource, NULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue