mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	server: Save the display name in the wl_socket
This allows us to return the display name to the client in a new API.
This commit is contained in:
		
							parent
							
								
									7ec34fd097
								
							
						
					
					
						commit
						f0401059b9
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -63,6 +63,7 @@ struct wl_socket {
 | 
				
			||||||
	char lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN];
 | 
						char lock_addr[UNIX_PATH_MAX + LOCK_SUFFIXLEN];
 | 
				
			||||||
	struct wl_list link;
 | 
						struct wl_list link;
 | 
				
			||||||
	struct wl_event_source *source;
 | 
						struct wl_event_source *source;
 | 
				
			||||||
 | 
						char *display_name;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wl_client {
 | 
					struct wl_client {
 | 
				
			||||||
| 
						 | 
					@ -1081,6 +1082,8 @@ wl_socket_init_for_display_name(struct wl_socket *s, const char *name)
 | 
				
			||||||
	name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path,
 | 
						name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path,
 | 
				
			||||||
			     "%s/%s", runtime_dir, name) + 1;
 | 
								     "%s/%s", runtime_dir, name) + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						s->display_name = (s->addr.sun_path + name_size - 1) - strlen(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(name_size > 0);
 | 
						assert(name_size > 0);
 | 
				
			||||||
	if (name_size > (int)sizeof s->addr.sun_path) {
 | 
						if (name_size > (int)sizeof s->addr.sun_path) {
 | 
				
			||||||
		wl_log("error: socket path \"%s/%s\" plus null terminator"
 | 
							wl_log("error: socket path \"%s/%s\" plus null terminator"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue