mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	WindowServer: Adjust position of flipped submenus by menu item height
Fixes #5950.
This commit is contained in:
		
							parent
							
								
									8461100bf7
								
							
						
					
					
						commit
						b220c89c5c
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		|  | @ -288,7 +288,7 @@ void Menu::update_for_new_hovered_item(bool make_input) | ||||||
|     if (hovered_item() && hovered_item()->is_submenu()) { |     if (hovered_item() && hovered_item()->is_submenu()) { | ||||||
|         VERIFY(menu_window()); |         VERIFY(menu_window()); | ||||||
|         MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu()); |         MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu()); | ||||||
|         hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input); |         hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input, true); | ||||||
|     } else { |     } else { | ||||||
|         MenuManager::the().close_everyone_not_in_lineage(*this); |         MenuManager::the().close_everyone_not_in_lineage(*this); | ||||||
|         ensure_menu_window().set_visible(true); |         ensure_menu_window().set_visible(true); | ||||||
|  | @ -518,7 +518,7 @@ void Menu::popup(const Gfx::IntPoint& position) | ||||||
|     do_popup(position, true); |     do_popup(position, true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Menu::do_popup(const Gfx::IntPoint& position, bool make_input) | void Menu::do_popup(const Gfx::IntPoint& position, bool make_input, bool as_submenu) | ||||||
| { | { | ||||||
|     if (is_empty()) { |     if (is_empty()) { | ||||||
|         dbgln("Menu: Empty menu popup"); |         dbgln("Menu: Empty menu popup"); | ||||||
|  | @ -536,6 +536,8 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input) | ||||||
|     } |     } | ||||||
|     if (adjusted_pos.y() + window.height() >= Screen::the().height() - margin) { |     if (adjusted_pos.y() + window.height() >= Screen::the().height() - margin) { | ||||||
|         adjusted_pos = adjusted_pos.translated(0, -window.height()); |         adjusted_pos = adjusted_pos.translated(0, -window.height()); | ||||||
|  |         if (as_submenu) | ||||||
|  |             adjusted_pos = adjusted_pos.translated(0, item_height()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (adjusted_pos.y() < MenuManager::the().menubar_rect().height()) |     if (adjusted_pos.y() < MenuManager::the().menubar_rect().height()) | ||||||
|  |  | ||||||
|  | @ -114,7 +114,7 @@ public: | ||||||
|     void close(); |     void close(); | ||||||
| 
 | 
 | ||||||
|     void popup(const Gfx::IntPoint&); |     void popup(const Gfx::IntPoint&); | ||||||
|     void do_popup(const Gfx::IntPoint&, bool); |     void do_popup(const Gfx::IntPoint&, bool make_input, bool as_submenu = false); | ||||||
| 
 | 
 | ||||||
|     bool is_menu_ancestor_of(const Menu&) const; |     bool is_menu_ancestor_of(const Menu&) const; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh