mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:52:45 +00:00 
			
		
		
		
	WindowManager: Make the Logo key open the system menu
This commit is contained in:
		
							parent
							
								
									c51209a06a
								
							
						
					
					
						commit
						7ee6c66ee9
					
				
					 2 changed files with 19 additions and 0 deletions
				
			
		|  | @ -1087,6 +1087,9 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const | |||
| void WindowManager::event(Core::Event& event) | ||||
| { | ||||
|     if (static_cast<Event&>(event).is_mouse_event()) { | ||||
|         if (event.type() != Event::MouseMove) | ||||
|             m_previous_event_is_key_down_logo = false; | ||||
| 
 | ||||
|         Window* hovered_window = nullptr; | ||||
|         process_mouse_event(static_cast<MouseEvent&>(event), hovered_window); | ||||
|         set_hovered_window(hovered_window); | ||||
|  | @ -1116,6 +1119,20 @@ void WindowManager::event(Core::Event& event) | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (key_event.type() == Event::KeyDown && key_event.key() == Key_Logo) { | ||||
|             m_previous_event_is_key_down_logo = true; | ||||
|         } else if (m_previous_event_is_key_down_logo) { | ||||
|             m_previous_event_is_key_down_logo = false; | ||||
|             if (key_event.type() == Event::KeyUp && key_event.key() == Key_Logo) { | ||||
|                 if (MenuManager::the().has_open_menu()) { | ||||
|                     MenuManager::the().close_everyone(); | ||||
|                 } else { | ||||
|                     MenuManager::the().open_menu(*MenuManager::the().system_menu()); | ||||
|                 } | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (MenuManager::the().current_menu()) { | ||||
|             MenuManager::the().dispatch_event(event); | ||||
|             return; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jean-Baptiste Boric
						Jean-Baptiste Boric