mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Add wl_resource_create() and a version field to wl_resource
A new function, wl_resource_create(), lets the compositor create a wl_resource for a given version of the interface. Passing 0 for the object ID will allocate a new ID. The implementation, user data and destructor can be set with wl_resource_set_implementation(). These two functions deprecates wl_client_add/new_object and the main difference and motivation is the ability to provide a version number for the resource. This lets the compositor track which version of the interface a client has created and we'll use that to verify incoming requests. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
		
							parent
							
								
									d35b6278c0
								
							
						
					
					
						commit
						4917a967bd
					
				
					 3 changed files with 80 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -242,6 +242,16 @@ void wl_resource_post_no_memory(struct wl_resource *resource);
 | 
			
		|||
struct wl_display *
 | 
			
		||||
wl_client_get_display(struct wl_client *client);
 | 
			
		||||
 | 
			
		||||
struct wl_resource *
 | 
			
		||||
wl_resource_create(struct wl_client *client,
 | 
			
		||||
		   const struct wl_interface *interface,
 | 
			
		||||
		   int version, uint32_t id);
 | 
			
		||||
void
 | 
			
		||||
wl_resource_set_implementation(struct wl_resource *resource,
 | 
			
		||||
			       const void *implementation,
 | 
			
		||||
			       void *data,
 | 
			
		||||
			       wl_resource_destroy_func_t destroy);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
wl_resource_destroy(struct wl_resource *resource);
 | 
			
		||||
uint32_t
 | 
			
		||||
| 
						 | 
				
			
			@ -258,6 +268,8 @@ void
 | 
			
		|||
wl_resource_set_user_data(struct wl_resource *resource, void *data);
 | 
			
		||||
void *
 | 
			
		||||
wl_resource_get_user_data(struct wl_resource *resource);
 | 
			
		||||
int
 | 
			
		||||
wl_resource_get_version(struct wl_resource *resource);
 | 
			
		||||
void
 | 
			
		||||
wl_resource_set_destructor(struct wl_resource *resource,
 | 
			
		||||
			   wl_resource_destroy_func_t destroy);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue