1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

Browser+LibGUI+WindowServer: Open Button menus uniformly

Instead of letting buttons determine the relative position
of their menus, a workaround only used by Statusbar segments,
open them all uniformly for a nice, consistent UI.

Passing a rect to popup() now routes to open_button_menu(), an
analog to open_menubar_menu(), which adjusts the menu's popup
position in the same way. Fixes button menus obscuring the buttons
which spawn them and jutting out at odd corners depending on screen
position.
This commit is contained in:
thankyouverycool 2022-09-04 19:48:37 -04:00 committed by Linus Groh
parent 0fc1925cd7
commit 35e557c657
12 changed files with 34 additions and 31 deletions

View file

@ -116,10 +116,10 @@ void Menu::realize_if_needed(RefPtr<Action> const& default_action)
realize_menu(default_action);
}
void Menu::popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action)
void Menu::popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action, Gfx::IntRect const& button_rect)
{
realize_if_needed(default_action);
ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position);
ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position, button_rect);
}
void Menu::dismiss()