mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	config: reuse mousebind_button_from_str()
This commit is contained in:
		
							parent
							
								
									4c59a8c3d7
								
							
						
					
					
						commit
						e51c3fc5d4
					
				
					 3 changed files with 1 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -20,7 +20,6 @@ struct button_map_entry {
 | 
			
		|||
double tablet_get_dbl_if_positive(const char *content, const char *name);
 | 
			
		||||
enum rotation tablet_parse_rotation(int value);
 | 
			
		||||
uint32_t tablet_button_from_str(const char *button);
 | 
			
		||||
uint32_t mouse_button_from_str(const char *button);
 | 
			
		||||
void tablet_button_mapping_add(uint32_t from, uint32_t to);
 | 
			
		||||
void tablet_load_default_button_mappings(void);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -868,7 +868,7 @@ entry(xmlNode *node, char *nodename, char *content)
 | 
			
		|||
		button_map_from = tablet_button_from_str(content);
 | 
			
		||||
	} else if (!strcasecmp(nodename, "to.map.tablet")) {
 | 
			
		||||
		if (button_map_from != UINT32_MAX) {
 | 
			
		||||
			uint32_t button_map_to = mouse_button_from_str(content);
 | 
			
		||||
			uint32_t button_map_to = mousebind_button_from_str(content, NULL);
 | 
			
		||||
			if (button_map_to != UINT32_MAX) {
 | 
			
		||||
				tablet_button_mapping_add(button_map_from, button_map_to);
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,20 +72,6 @@ tablet_button_from_str(const char *button)
 | 
			
		|||
	return UINT32_MAX;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t
 | 
			
		||||
mouse_button_from_str(const char *button)
 | 
			
		||||
{
 | 
			
		||||
	if (!strcasecmp(button, "Left")) {
 | 
			
		||||
		return BTN_LEFT;
 | 
			
		||||
	} else if (!strcasecmp(button, "Right")) {
 | 
			
		||||
		return BTN_RIGHT;
 | 
			
		||||
	} else if (!strcasecmp(button, "Middle")) {
 | 
			
		||||
		return BTN_MIDDLE;
 | 
			
		||||
	}
 | 
			
		||||
	wlr_log(WLR_ERROR, "Invalid value for mouse button: %s", button);
 | 
			
		||||
	return UINT32_MAX;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
tablet_button_mapping_add(uint32_t from, uint32_t to)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue