mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()
This new function replaces wlr_surface_is_xwayland_surface() and wlr_xwayland_surface_from_wlr_surface().
This commit is contained in:
		
							parent
							
								
									21f8388b58
								
							
						
					
					
						commit
						fbf5982e38
					
				
					 2 changed files with 7 additions and 16 deletions
				
			
		| 
						 | 
					@ -231,20 +231,13 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
 | 
				
			||||||
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
 | 
					void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
 | 
				
			||||||
	struct wlr_seat *seat);
 | 
						struct wlr_seat *seat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Check whether a surface is an Xwayland surface.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * As an edge case, if the surface has been created by Xwayland but has no X11
 | 
					 | 
				
			||||||
 * window associated, false is returned.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Get a struct wlr_xwayland_surface from a struct wlr_surface.
 | 
					 * Get a struct wlr_xwayland_surface from a struct wlr_surface.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This function asserts that the surface is an Xwayland surface.
 | 
					 * If the surface hasn't been created by Xwayland or has no X11 window
 | 
				
			||||||
 | 
					 * associated, NULL is returned.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
 | 
					struct wlr_xwayland_surface *wlr_xwayland_surface_try_from_wlr_surface(
 | 
				
			||||||
	struct wlr_surface *surface);
 | 
						struct wlr_surface *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface);
 | 
					void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,14 +101,12 @@ struct pending_startup_id {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct wlr_addon_interface surface_addon_impl;
 | 
					static const struct wlr_addon_interface surface_addon_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface) {
 | 
					struct wlr_xwayland_surface *wlr_xwayland_surface_try_from_wlr_surface(
 | 
				
			||||||
	return wlr_addon_find(&surface->addons, NULL, &surface_addon_impl) != NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
 | 
					 | 
				
			||||||
		struct wlr_surface *surface) {
 | 
							struct wlr_surface *surface) {
 | 
				
			||||||
	struct wlr_addon *addon = wlr_addon_find(&surface->addons, NULL, &surface_addon_impl);
 | 
						struct wlr_addon *addon = wlr_addon_find(&surface->addons, NULL, &surface_addon_impl);
 | 
				
			||||||
	assert(addon != NULL);
 | 
						if (addon == NULL) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	struct wlr_xwayland_surface *xsurface = wl_container_of(addon, xsurface, surface_addon);
 | 
						struct wlr_xwayland_surface *xsurface = wl_container_of(addon, xsurface, surface_addon);
 | 
				
			||||||
	return xsurface;
 | 
						return xsurface;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue