mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Add commit request + ack event to wayland core.
Use in window.c to manage life cycle of buffer correctly.
This commit is contained in:
		
							parent
							
								
									961a04cef0
								
							
						
					
					
						commit
						4097923a64
					
				
					 4 changed files with 166 additions and 82 deletions
				
			
		
							
								
								
									
										23
									
								
								wayland.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								wayland.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -315,6 +315,7 @@ wl_client_event(struct wl_client *client, struct wl_object *object, uint32_t eve
 | 
			
		|||
#define WL_DISPLAY_INVALID_OBJECT 0
 | 
			
		||||
#define WL_DISPLAY_INVALID_METHOD 1
 | 
			
		||||
#define WL_DISPLAY_NO_MEMORY 2
 | 
			
		||||
#define WL_DISPLAY_ACKNOWLEDGE 3
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
wl_client_connection_data(int fd, uint32_t mask, void *data)
 | 
			
		||||
| 
						 | 
				
			
			@ -495,14 +496,36 @@ static const struct wl_argument create_surface_arguments[] = {
 | 
			
		|||
	{ WL_ARGUMENT_NEW_ID }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
wl_display_commit(struct wl_client *client,
 | 
			
		||||
		  struct wl_display *display, uint32_t key)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t event[3];
 | 
			
		||||
 | 
			
		||||
	event[0] = display->base.id;
 | 
			
		||||
	event[1] = WL_DISPLAY_ACKNOWLEDGE | ((sizeof event) << 16);
 | 
			
		||||
	event[2] = key;
 | 
			
		||||
	wl_connection_write(client->connection, event, sizeof event);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct wl_argument commit_arguments[] = {
 | 
			
		||||
	{ WL_ARGUMENT_UINT32 }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct wl_method display_methods[] = {
 | 
			
		||||
	{ "create_surface", wl_display_create_surface,
 | 
			
		||||
	  ARRAY_LENGTH(create_surface_arguments), create_surface_arguments },
 | 
			
		||||
	{ "commit", wl_display_commit,
 | 
			
		||||
	  ARRAY_LENGTH(commit_arguments), commit_arguments },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct wl_event display_events[] = {
 | 
			
		||||
	{ "invalid_object" },
 | 
			
		||||
	{ "invalid_method" },
 | 
			
		||||
	{ "no_memory" },
 | 
			
		||||
	{ "acknowledge" },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const struct wl_interface display_interface = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue