summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-03-14 18:00:43 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-14 22:29:57 +0100
commitfe47e664387d0fcc6ff35f3fb9fcf840aca10d1a (patch)
tree30be54d603c02d2016f12bd2e741794cf091c184 /Userland
parent11f82a32d4432f217d3e45de120e6d9348d0161b (diff)
downloadserenity-fe47e664387d0fcc6ff35f3fb9fcf840aca10d1a.zip
WindowServer: Use font height for item heights in Menus
The height of menu items was relatively small on larger fonts.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Services/WindowServer/Menu.cpp5
-rw-r--r--Userland/Services/WindowServer/Menu.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp
index fae82b482b..7112cb0808 100644
--- a/Userland/Services/WindowServer/Menu.cpp
+++ b/Userland/Services/WindowServer/Menu.cpp
@@ -95,6 +95,11 @@ int Menu::content_width() const
return max(widest_item, rect_in_window_menubar().width()) + horizontal_padding() + frame_thickness() * 2;
}
+int Menu::item_height() const
+{
+ return max(font().preferred_line_height(), s_item_icon_width + 2) + 4;
+}
+
void Menu::redraw()
{
if (!menu_window())
diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h
index 806131d802..348b58436e 100644
--- a/Userland/Services/WindowServer/Menu.h
+++ b/Userland/Services/WindowServer/Menu.h
@@ -86,7 +86,7 @@ public:
int content_width() const;
- static constexpr int item_height() { return 22; }
+ int item_height() const;
static constexpr int frame_thickness() { return 2; }
static constexpr int horizontal_padding() { return left_padding() + right_padding(); }
static constexpr int left_padding() { return 14; }