From d3fcba78b04509019245d8c3a0af05d3e1c6d04c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 19 Sep 2020 18:31:30 +0200 Subject: [PATCH] WindowServer: Shrink menubar menu text rects slightly We don't want the menu titles to cover the entire menubar. --- Services/WindowServer/MenuManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Services/WindowServer/MenuManager.cpp b/Services/WindowServer/MenuManager.cpp index 7ea8f5aa11..7ae2c73dac 100644 --- a/Services/WindowServer/MenuManager.cpp +++ b/Services/WindowServer/MenuManager.cpp @@ -109,6 +109,7 @@ void MenuManager::draw() menu.title_font(), Gfx::TextAlignment::CenterLeft, text_color); + //painter.draw_rect(menu.text_rect_in_menubar(), Color::Magenta); return IterationDecision::Continue; }); @@ -466,7 +467,10 @@ void MenuManager::set_current_menubar(MenuBar* menubar) for_each_active_menubar_menu([&](Menu& menu) { int text_width = menu.title_font().width(menu.name()); menu.set_rect_in_menubar({ next_menu_location.x() - MenuManager::menubar_menu_margin() / 2, 0, text_width + MenuManager::menubar_menu_margin(), menubar_rect().height() - 1 }); - menu.set_text_rect_in_menubar({ next_menu_location, { text_width, menubar_rect().height() } }); + + Gfx::IntRect text_rect { next_menu_location.translated(0, 1), { text_width, menubar_rect().height() - 3 } }; + + menu.set_text_rect_in_menubar(text_rect); next_menu_location.move_by(menu.rect_in_menubar().width(), 0); return IterationDecision::Continue; });