mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xdg-surface: assert that xdg_surface isn't inert
This commit is contained in:
		
							parent
							
								
									5ef42e8e8a
								
							
						
					
					
						commit
						016494af1b
					
				
					 1 changed files with 3 additions and 9 deletions
				
			
		| 
						 | 
					@ -183,13 +183,11 @@ static void xdg_surface_handle_get_popup(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *positioner_resource) {
 | 
							struct wl_resource *positioner_resource) {
 | 
				
			||||||
	struct wlr_xdg_surface *xdg_surface =
 | 
						struct wlr_xdg_surface *xdg_surface =
 | 
				
			||||||
		wlr_xdg_surface_from_resource(resource);
 | 
							wlr_xdg_surface_from_resource(resource);
 | 
				
			||||||
 | 
						assert(xdg_surface != NULL);
 | 
				
			||||||
	struct wlr_xdg_surface *parent = NULL;
 | 
						struct wlr_xdg_surface *parent = NULL;
 | 
				
			||||||
	if (parent_resource != NULL) {
 | 
						if (parent_resource != NULL) {
 | 
				
			||||||
		parent = wlr_xdg_surface_from_resource(parent_resource);
 | 
							parent = wlr_xdg_surface_from_resource(parent_resource);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (xdg_surface == NULL) {
 | 
					 | 
				
			||||||
		return; // TODO: create an inert xdg_popup
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	struct wlr_xdg_positioner *positioner =
 | 
						struct wlr_xdg_positioner *positioner =
 | 
				
			||||||
		wlr_xdg_positioner_from_resource(positioner_resource);
 | 
							wlr_xdg_positioner_from_resource(positioner_resource);
 | 
				
			||||||
	create_xdg_popup(xdg_surface, parent, positioner, id);
 | 
						create_xdg_popup(xdg_surface, parent, positioner, id);
 | 
				
			||||||
| 
						 | 
					@ -199,9 +197,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource, uint32_t id) {
 | 
							struct wl_resource *resource, uint32_t id) {
 | 
				
			||||||
	struct wlr_xdg_surface *xdg_surface =
 | 
						struct wlr_xdg_surface *xdg_surface =
 | 
				
			||||||
		wlr_xdg_surface_from_resource(resource);
 | 
							wlr_xdg_surface_from_resource(resource);
 | 
				
			||||||
	if (xdg_surface == NULL) {
 | 
						assert(xdg_surface != NULL);
 | 
				
			||||||
		return; // TODO: create an inert xdg_toplevel
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	create_xdg_toplevel(xdg_surface, id);
 | 
						create_xdg_toplevel(xdg_surface, id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -209,9 +205,7 @@ static void xdg_surface_handle_set_window_geometry(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource, int32_t x, int32_t y, int32_t width,
 | 
							struct wl_resource *resource, int32_t x, int32_t y, int32_t width,
 | 
				
			||||||
		int32_t height) {
 | 
							int32_t height) {
 | 
				
			||||||
	struct wlr_xdg_surface *surface = wlr_xdg_surface_from_resource(resource);
 | 
						struct wlr_xdg_surface *surface = wlr_xdg_surface_from_resource(resource);
 | 
				
			||||||
	if (surface == NULL) {
 | 
						assert(surface != NULL);
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (surface->role == WLR_XDG_SURFACE_ROLE_NONE) {
 | 
						if (surface->role == WLR_XDG_SURFACE_ROLE_NONE) {
 | 
				
			||||||
		wl_resource_post_error(surface->resource,
 | 
							wl_resource_post_error(surface->resource,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue