mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	config: replace enums with int to handle negative values
This commit also fixes that an invalid value in <accelProfile> is interpreted as "flat"
This commit is contained in:
		
							parent
							
								
									3c3656f74e
								
							
						
					
					
						commit
						19ffbae320
					
				
					 2 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
					@ -21,11 +21,11 @@ struct libinput_category {
 | 
				
			||||||
	int left_handed;
 | 
						int left_handed;
 | 
				
			||||||
	enum libinput_config_tap_state tap;
 | 
						enum libinput_config_tap_state tap;
 | 
				
			||||||
	enum libinput_config_tap_button_map tap_button_map;
 | 
						enum libinput_config_tap_button_map tap_button_map;
 | 
				
			||||||
	enum libinput_config_drag_state tap_and_drag;
 | 
						int tap_and_drag; /* -1 or libinput_config_drag_state */
 | 
				
			||||||
	enum libinput_config_drag_lock_state drag_lock;
 | 
						int drag_lock; /* -1 or libinput_config_drag_lock_state */
 | 
				
			||||||
	enum libinput_config_accel_profile accel_profile;
 | 
						int accel_profile; /* -1 or libinput_config_accel_profile */
 | 
				
			||||||
	enum libinput_config_middle_emulation_state middle_emu;
 | 
						int middle_emu; /* -1 or libinput_config_middle_emulation_state */
 | 
				
			||||||
	enum libinput_config_dwt_state dwt;
 | 
						int dwt; /* -1 or libinput_config_dwt_state */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum device_type get_device_type(const char *s);
 | 
					enum device_type get_device_type(const char *s);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -339,11 +339,11 @@ fill_mousebind(char *nodename, char *content)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static enum libinput_config_accel_profile
 | 
					static int
 | 
				
			||||||
get_accel_profile(const char *s)
 | 
					get_accel_profile(const char *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!s) {
 | 
						if (!s) {
 | 
				
			||||||
		return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!strcasecmp(s, "flat")) {
 | 
						if (!strcasecmp(s, "flat")) {
 | 
				
			||||||
		return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
 | 
							return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
 | 
				
			||||||
| 
						 | 
					@ -351,7 +351,7 @@ get_accel_profile(const char *s)
 | 
				
			||||||
	if (!strcasecmp(s, "adaptive")) {
 | 
						if (!strcasecmp(s, "adaptive")) {
 | 
				
			||||||
		return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
 | 
							return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
 | 
						return -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue