mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which will cause the event loop to listen for that key combination app-globally and activate the event in case it's pressed. The shortcut will also be displayed when the action is added to a menu. Use this to hook up Alt+Up with the "open parent directory" action in the FileManager app. :^)
This commit is contained in:
		
							parent
							
								
									5c0fca0a95
								
							
						
					
					
						commit
						596a5ce5a4
					
				
					 17 changed files with 263 additions and 17 deletions
				
			
		|  | @ -210,14 +210,13 @@ void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request) | |||
| { | ||||
|     int menu_id = request.menu_id(); | ||||
|     unsigned identifier = request.identifier(); | ||||
|     String text = request.text(); | ||||
|     auto it = m_menus.find(menu_id); | ||||
|     if (it == m_menus.end()) { | ||||
|         post_error("Bad menu ID"); | ||||
|         return; | ||||
|     } | ||||
|     auto& menu = *(*it).value; | ||||
|     menu.add_item(make<WSMenuItem>(identifier, move(text))); | ||||
|     menu.add_item(make<WSMenuItem>(identifier, request.text(), request.shortcut_text())); | ||||
|     WSAPI_ServerMessage response; | ||||
|     response.type = WSAPI_ServerMessage::Type::DidAddMenuItem; | ||||
|     response.menu.menu_id = menu_id; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling