mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:52:45 +00:00 
			
		
		
		
	LibGUI: Search the entire focus chain for shortcut actions
Instead of only looking in the focused widget, we now also look in the ancestor chain of that widget for any ancestor with a registered action for the given shortcut. This makes it possible for parent widgets to capture action activations while one of their children is focused.
This commit is contained in:
		
							parent
							
								
									896decd4d5
								
							
						
					
					
						commit
						d0578bfa32
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -148,8 +148,10 @@ void WindowServerConnection::handle(const Messages::WindowClient::KeyDown& messa | |||
| 
 | ||||
|     Action* action = nullptr; | ||||
| 
 | ||||
|     if (auto* focused_widget = window->focused_widget()) | ||||
|         action = focused_widget->action_for_key_event(*key_event); | ||||
|     if (auto* focused_widget = window->focused_widget()) { | ||||
|         for (auto* widget = focused_widget; widget && !action; widget = widget->parent_widget()) | ||||
|             action = focused_widget->action_for_key_event(*key_event); | ||||
|     } | ||||
| 
 | ||||
|     if (!action) | ||||
|         action = window->action_for_key_event(*key_event); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling