Skip to content

Commit

Permalink
WindowServer: Shrink menubar menu text rects slightly
Browse files Browse the repository at this point in the history
We don't want the menu titles to cover the entire menubar.
  • Loading branch information
awesomekling committed Sep 19, 2020
1 parent 5f8a9d3 commit d3fcba7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Services/WindowServer/MenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down Expand Up @@ -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;
});
Expand Down

0 comments on commit d3fcba7

Please sign in to comment.