mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	keyboard: update repeat timer before execution
Since the keyboard can be destroyed by executing a binding (reloading with a different seat attachment config), update the repeat timer before executing the binding.
This commit is contained in:
		
							parent
							
								
									da8f24de1d
								
							
						
					
					
						commit
						1feb2ce064
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -295,14 +295,10 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		get_active_binding(&keyboard->state_keysyms_raw,
 | 
							get_active_binding(&keyboard->state_keysyms_raw,
 | 
				
			||||||
				config->current_mode->keysym_bindings, &binding,
 | 
									config->current_mode->keysym_bindings, &binding,
 | 
				
			||||||
				raw_modifiers, false, input_inhibited, device_identifier);
 | 
									raw_modifiers, false, input_inhibited, device_identifier);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (binding) {
 | 
					 | 
				
			||||||
			seat_execute_command(seat, binding);
 | 
					 | 
				
			||||||
			handled = true;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Set up (or clear) keyboard repeat for a pressed binding
 | 
						// Set up (or clear) keyboard repeat for a pressed binding. Since the
 | 
				
			||||||
 | 
						// binding may remove the keyboard, the timer needs to be updated first
 | 
				
			||||||
	if (binding && wlr_device->keyboard->repeat_info.delay > 0) {
 | 
						if (binding && wlr_device->keyboard->repeat_info.delay > 0) {
 | 
				
			||||||
		keyboard->repeat_binding = binding;
 | 
							keyboard->repeat_binding = binding;
 | 
				
			||||||
		if (wl_event_source_timer_update(keyboard->key_repeat_source,
 | 
							if (wl_event_source_timer_update(keyboard->key_repeat_source,
 | 
				
			||||||
| 
						 | 
					@ -316,6 +312,11 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (binding) {
 | 
				
			||||||
 | 
							seat_execute_command(seat, binding);
 | 
				
			||||||
 | 
							handled = true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Compositor bindings
 | 
						// Compositor bindings
 | 
				
			||||||
	if (!handled && event->state == WLR_KEY_PRESSED) {
 | 
						if (!handled && event->state == WLR_KEY_PRESSED) {
 | 
				
			||||||
		handled = keyboard_execute_compositor_binding(
 | 
							handled = keyboard_execute_compositor_binding(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue