mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	rcxml: Make sure a default libinput category always exists
Previously, if rc.xml defined only non-default libinput categories, no default category was created. This meant that configure_libinput() might totally skip configuring some devices even with default settings, like tap-to-click. Fix this by making sure that a default category is always created.
This commit is contained in:
		
							parent
							
								
									500eddbe88
								
							
						
					
					
						commit
						41a4176b17
					
				
					 4 changed files with 26 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -9,6 +9,7 @@
 | 
			
		|||
static void
 | 
			
		||||
libinput_category_init(struct libinput_category *l)
 | 
			
		||||
{
 | 
			
		||||
	l->type = DEFAULT_DEVICE;
 | 
			
		||||
	l->name = NULL;
 | 
			
		||||
	l->pointer_speed = -2;
 | 
			
		||||
	l->natural_scroll = -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -43,3 +44,19 @@ libinput_category_create(void)
 | 
			
		|||
	wl_list_insert(&rc.libinput_categories, &l->link);
 | 
			
		||||
	return l;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The default category is the first one with type == DEFAULT_DEVICE and
 | 
			
		||||
 * no name. After rcxml_read(), a default category always exists.
 | 
			
		||||
 */
 | 
			
		||||
struct libinput_category *
 | 
			
		||||
libinput_category_get_default(void)
 | 
			
		||||
{
 | 
			
		||||
	struct libinput_category *l;
 | 
			
		||||
	wl_list_for_each(l, &rc.libinput_categories, link) {
 | 
			
		||||
		if (l->type == DEFAULT_DEVICE && !l->name) {
 | 
			
		||||
			return l;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue