mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Remove almost-always redundant loop in key handling
This commit is contained in:
		
							parent
							
								
									705230a26c
								
							
						
					
					
						commit
						f2fe93d171
					
				
					 1 changed files with 22 additions and 26 deletions
				
			
		| 
						 | 
					@ -229,13 +229,12 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// identify which binding should be executed.
 | 
						// identify which binding should be executed.
 | 
				
			||||||
	struct sway_binding *binding =
 | 
						struct sway_binding *binding = check_shortcut_model(
 | 
				
			||||||
		check_shortcut_model(&keyboard->state_keycodes,
 | 
								&keyboard->state_keycodes,
 | 
				
			||||||
			config->current_mode->keycode_bindings,
 | 
								config->current_mode->keycode_bindings,
 | 
				
			||||||
			code_modifiers, input_inhibited);
 | 
								code_modifiers, input_inhibited);
 | 
				
			||||||
	for (size_t i=0;i<translated_keysyms_len;i++) {
 | 
						struct sway_binding *translated_binding = check_shortcut_model(
 | 
				
			||||||
		struct sway_binding *translated_binding =
 | 
								&keyboard->state_keysyms_translated,
 | 
				
			||||||
			check_shortcut_model(&keyboard->state_keysyms_translated,
 | 
					 | 
				
			||||||
			config->current_mode->keysym_bindings,
 | 
								config->current_mode->keysym_bindings,
 | 
				
			||||||
			translated_modifiers, input_inhibited);
 | 
								translated_modifiers, input_inhibited);
 | 
				
			||||||
	if (translated_binding && !binding) {
 | 
						if (translated_binding && !binding) {
 | 
				
			||||||
| 
						 | 
					@ -244,10 +243,8 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d",
 | 
							wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d",
 | 
				
			||||||
			binding->order, translated_binding->order);
 | 
								binding->order, translated_binding->order);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
						struct sway_binding *raw_binding = check_shortcut_model(
 | 
				
			||||||
	for (size_t i=0;i<raw_keysyms_len;i++) {
 | 
								&keyboard->state_keysyms_raw,
 | 
				
			||||||
		struct sway_binding *raw_binding =
 | 
					 | 
				
			||||||
			check_shortcut_model(&keyboard->state_keysyms_raw,
 | 
					 | 
				
			||||||
			config->current_mode->keysym_bindings,
 | 
								config->current_mode->keysym_bindings,
 | 
				
			||||||
			raw_modifiers, input_inhibited);
 | 
								raw_modifiers, input_inhibited);
 | 
				
			||||||
	if (raw_binding && !binding) {
 | 
						if (raw_binding && !binding) {
 | 
				
			||||||
| 
						 | 
					@ -256,7 +253,6 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d",
 | 
							wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d",
 | 
				
			||||||
			binding->order, raw_binding->order);
 | 
								binding->order, raw_binding->order);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool handled = false;
 | 
						bool handled = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue