1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

WindowServer+LibGfx: Make menubar menus slightly larger

Also make sure the left/right padding is equally large.
This commit is contained in:
Andreas Kling 2021-03-26 14:24:04 +01:00
parent 3020f5efd9
commit 4b6fba1e4c
5 changed files with 9 additions and 16 deletions

View file

@ -949,15 +949,11 @@ void Window::set_menubar(MenuBar* menubar)
m_menubar = menubar;
if (m_menubar) {
auto& wm = WindowManager::the();
Gfx::IntPoint next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 };
Gfx::IntPoint next_menu_location { 0, 0 };
auto menubar_rect = Gfx::WindowTheme::current().menu_bar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1);
m_menubar->for_each_menu([&](Menu& menu) {
int text_width = wm.font().width(menu.name());
menu.set_rect_in_window_menubar({ next_menu_location.x() - MenuManager::menubar_menu_margin() / 2, 0, text_width + MenuManager::menubar_menu_margin(), menubar_rect.height() });
Gfx::IntRect text_rect { next_menu_location.translated(0, 1), { text_width, menubar_rect.height() - 3 } };
menu.set_text_rect_in_window_menubar(text_rect);
menu.set_rect_in_window_menubar({ next_menu_location.x(), 0, text_width + MenuManager::menubar_menu_margin(), menubar_rect.height() });
next_menu_location.move_by(menu.rect_in_window_menubar().width(), 0);
return IterationDecision::Continue;
});