|  |  |  | @ -5,6 +5,7 @@ | 
			
		
	
		
			
				
					|  |  |  |  | #include <stdio.h> | 
			
		
	
		
			
				
					|  |  |  |  | #include <string.h> | 
			
		
	
		
			
				
					|  |  |  |  | #include <libinput.h> | 
			
		
	
		
			
				
					|  |  |  |  | #include <math.h> | 
			
		
	
		
			
				
					|  |  |  |  | #include "sway/config.h" | 
			
		
	
		
			
				
					|  |  |  |  | #include "sway/input/input-manager.h" | 
			
		
	
		
			
				
					|  |  |  |  | #include "sway/input/seat.h" | 
			
		
	
	
		
			
				
					|  |  |  | @ -33,6 +34,13 @@ static struct sway_seat *input_manager_get_seat( | 
			
		
	
		
			
				
					|  |  |  |  | 	return sway_seat_create(input, seat_name); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static inline int strlen_num(int num) { | 
			
		
	
		
			
				
					|  |  |  |  | 	if (num == 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 		return 2; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	return (int)((ceil(log10(abs(num)))+2)); | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | static char *get_device_identifier(struct wlr_input_device *device) { | 
			
		
	
		
			
				
					|  |  |  |  | 	int vendor = device->vendor; | 
			
		
	
		
			
				
					|  |  |  |  | 	int product = device->product; | 
			
		
	
	
		
			
				
					|  |  |  | @ -46,9 +54,12 @@ static char *get_device_identifier(struct wlr_input_device *device) { | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	sway_log(L_DEBUG, "rewritten name %s", name); | 
			
		
	
		
			
				
					|  |  |  |  | 	int len = | 
			
		
	
		
			
				
					|  |  |  |  | 		(strlen(name) + | 
			
		
	
		
			
				
					|  |  |  |  | 		 strlen_num(device->vendor) + | 
			
		
	
		
			
				
					|  |  |  |  | 		 strlen_num(device->product) + | 
			
		
	
		
			
				
					|  |  |  |  | 		 3) * sizeof(char); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	int len = strlen(name) + sizeof(char) * 6; | 
			
		
	
		
			
				
					|  |  |  |  | 	char *identifier = malloc(len); | 
			
		
	
		
			
				
					|  |  |  |  | 	if (!identifier) { | 
			
		
	
		
			
				
					|  |  |  |  | 		sway_log(L_ERROR, "Unable to allocate unique input device name"); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |