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

WindowServer: Strip Alt-shortcut marker ('&') when measuring menu texts

We were including these markers when computing the sizes of menus,
causing them to get a little too much padding.
This commit is contained in:
Andreas Kling 2021-04-12 15:24:17 +02:00
parent fbbb4b3395
commit 767bd8cc88
2 changed files with 2 additions and 2 deletions

View file

@ -990,7 +990,7 @@ void Window::set_menubar(MenuBar* menubar)
Gfx::IntPoint next_menu_location { 0, 0 };
auto menubar_rect = Gfx::WindowTheme::current().menubar_rect(Gfx::WindowTheme::WindowType::Normal, rect(), wm.palette(), 1);
m_menubar->for_each_menu([&](Menu& menu) {
int text_width = wm.font().width(menu.name());
int text_width = wm.font().width(Gfx::parse_ampersand_string(menu.name()));
menu.set_rect_in_window_menubar({ next_menu_location.x(), 0, text_width + menubar_menu_margin, menubar_rect.height() });
next_menu_location.move_by(menu.rect_in_window_menubar().width(), 0);
return IterationDecision::Continue;