diff options
author | Linus Groh <mail@linusgroh.de> | 2021-03-26 09:22:31 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-26 09:25:22 +0100 |
commit | b220c89c5c68f0714f1d84a0a4dbc82bff7424c2 (patch) | |
tree | 36d579f331b9e273186be980407886242b0ff473 /Userland/Services | |
parent | 8461100bf70c3104341dc4c32383987f2daa2220 (diff) | |
download | serenity-b220c89c5c68f0714f1d84a0a4dbc82bff7424c2.zip |
WindowServer: Adjust position of flipped submenus by menu item height
Fixes #5950.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WindowServer/Menu.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WindowServer/Menu.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index ab2a5bba77..6b295a29d6 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -288,7 +288,7 @@ void Menu::update_for_new_hovered_item(bool make_input) if (hovered_item() && hovered_item()->is_submenu()) { VERIFY(menu_window()); 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 { MenuManager::the().close_everyone_not_in_lineage(*this); ensure_menu_window().set_visible(true); @@ -518,7 +518,7 @@ void Menu::popup(const Gfx::IntPoint& position) 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()) { 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) { 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()) diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index 3a35f727ac..e8d2905d58 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -114,7 +114,7 @@ public: void close(); 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; |