mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	
							parent
							
								
									2768af5a9b
								
							
						
					
					
						commit
						294fb324d8
					
				
					 2 changed files with 29 additions and 1 deletions
				
			
		
							
								
								
									
										21
									
								
								client.h
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								client.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -179,3 +179,24 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
 | 
			
		|||
#endif
 | 
			
		||||
	return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline Client *
 | 
			
		||||
client_from_popup(struct wlr_xdg_popup *popup)
 | 
			
		||||
{
 | 
			
		||||
	struct wlr_xdg_surface *surface = popup->base;
 | 
			
		||||
 | 
			
		||||
	while (1) {
 | 
			
		||||
		switch (surface->role) {
 | 
			
		||||
		case WLR_XDG_SURFACE_ROLE_POPUP:
 | 
			
		||||
			if (!wlr_surface_is_xdg_surface(surface->popup->parent))
 | 
			
		||||
				return NULL;
 | 
			
		||||
 | 
			
		||||
			surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
 | 
			
		||||
			break;
 | 
			
		||||
		case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
 | 
			
		||||
				return surface->data;
 | 
			
		||||
		case WLR_XDG_SURFACE_ROLE_NONE:
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -880,7 +880,14 @@ createnotify(struct wl_listener *listener, void *data)
 | 
			
		|||
	struct wlr_xdg_surface *xdg_surface = data;
 | 
			
		||||
	Client *c;
 | 
			
		||||
 | 
			
		||||
	if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
 | 
			
		||||
	if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
 | 
			
		||||
		struct wlr_box box;
 | 
			
		||||
		if (!(c = client_from_popup(xdg_surface->popup)))
 | 
			
		||||
			return;
 | 
			
		||||
		client_get_geometry(c, &box);
 | 
			
		||||
		wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &box);
 | 
			
		||||
		return;
 | 
			
		||||
	} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Allocate a Client for this surface */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue