mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	keybind: refactor update_keycodes_iter() to reduce nesting
update_keycodes_iter() currently has 4(!) levels of nested loops, which makes the logic (especially the break/continue statements) difficult to understand. The logic also appears to continue looping uselessly after a given keycode has already been added to a keybind. Refactor by adding some small utility functions: - keybind_contains_keycode() - keybind_contains_keysym() - keybind_contains_any_keysym() No functional change intended.
This commit is contained in:
		
							parent
							
								
									28513cbdbe
								
							
						
					
					
						commit
						6574c82aed
					
				
					 3 changed files with 56 additions and 33 deletions
				
			
		| 
						 | 
				
			
			@ -41,5 +41,8 @@ uint32_t parse_modifier(const char *symname);
 | 
			
		|||
 | 
			
		||||
bool keybind_the_same(struct keybind *a, struct keybind *b);
 | 
			
		||||
 | 
			
		||||
bool keybind_contains_keycode(struct keybind *keybind, xkb_keycode_t keycode);
 | 
			
		||||
bool keybind_contains_keysym(struct keybind *keybind, xkb_keysym_t keysym);
 | 
			
		||||
 | 
			
		||||
void keybind_update_keycodes(struct server *server);
 | 
			
		||||
#endif /* LABWC_KEYBIND_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue