mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	config: add finding touch configurations
This commit is contained in:
		
							parent
							
								
									2c3ab16f39
								
							
						
					
					
						commit
						3f77514459
					
				
					 3 changed files with 36 additions and 0 deletions
				
			
		| 
						 | 
					@ -11,4 +11,6 @@ struct touch_config_entry {
 | 
				
			||||||
	struct wl_list link;     /* struct rcxml.touch_configs */
 | 
						struct wl_list link;     /* struct rcxml.touch_configs */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct touch_config_entry *touch_find_config_for_device(char *device_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* LABWC_TOUCH_CONFIG_H */
 | 
					#endif /* LABWC_TOUCH_CONFIG_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ labwc_sources += files(
 | 
				
			||||||
  'keybind.c',
 | 
					  'keybind.c',
 | 
				
			||||||
  'session.c',
 | 
					  'session.c',
 | 
				
			||||||
  'mousebind.c',
 | 
					  'mousebind.c',
 | 
				
			||||||
 | 
					  'touch.c',
 | 
				
			||||||
  'tablet.c',
 | 
					  'tablet.c',
 | 
				
			||||||
  'libinput.c',
 | 
					  'libinput.c',
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										33
									
								
								src/config/touch.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/config/touch.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,33 @@
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: GPL-2.0-only
 | 
				
			||||||
 | 
					#define _POSIX_C_SOURCE 200809L
 | 
				
			||||||
 | 
					#include <strings.h>
 | 
				
			||||||
 | 
					#include <wlr/util/log.h>
 | 
				
			||||||
 | 
					#include "common/list.h"
 | 
				
			||||||
 | 
					#include "config/rcxml.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct touch_config_entry *
 | 
				
			||||||
 | 
					find_default_config(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct touch_config_entry *entry;
 | 
				
			||||||
 | 
						wl_list_for_each(entry, &rc.touch_configs, link) {
 | 
				
			||||||
 | 
							if (!entry->device_name) {
 | 
				
			||||||
 | 
								wlr_log(WLR_INFO, "found default touch configuration");
 | 
				
			||||||
 | 
								return entry;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct touch_config_entry *
 | 
				
			||||||
 | 
					touch_find_config_for_device(char *device_name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						wlr_log(WLR_INFO, "find touch configuration for %s\n", device_name);
 | 
				
			||||||
 | 
						struct touch_config_entry *entry;
 | 
				
			||||||
 | 
						wl_list_for_each(entry, &rc.touch_configs, link) {
 | 
				
			||||||
 | 
							if (entry->device_name && !strcasecmp(entry->device_name, device_name)) {
 | 
				
			||||||
 | 
								wlr_log(WLR_INFO, "found touch configuration for %s\n", device_name);
 | 
				
			||||||
 | 
								return entry;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return find_default_config();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue