summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Application.cpp
diff options
context:
space:
mode:
authorFrHun <28605587+frhun@users.noreply.github.com>2021-07-22 02:24:16 +0200
committerGunnar Beutner <gunnar@beutner.name>2021-07-22 04:33:41 +0200
commit02c0b1f380eb9042f64380b0a93b41c8c6f01254 (patch)
tree8bdb8f94d88c557ebd1e31acc66dce7056a4ebc1 /Userland/Libraries/LibGUI/Application.cpp
parent390454193845da268d1da7c2cd2bf67a572ba6ad (diff)
downloadserenity-02c0b1f380eb9042f64380b0a93b41c8c6f01254.zip
LibGUI: Fix multi-line tooltip height
Tooltips had a wrong calculation for the height of a tooltip window, because they forgot to take into account the line spacing.
Diffstat (limited to 'Userland/Libraries/LibGUI/Application.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Application.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp
index a16b557106..9a36856f3b 100644
--- a/Userland/Libraries/LibGUI/Application.cpp
+++ b/Userland/Libraries/LibGUI/Application.cpp
@@ -28,7 +28,9 @@ public:
{
m_label->set_text(Gfx::parse_ampersand_string(tooltip));
int tooltip_width = m_label->min_width() + 10;
- int tooltip_height = m_label->font().glyph_height() * max(1, m_label->text().count("\n")) + 8;
+ int line_count = m_label->text().count("\n");
+ int glyph_height = m_label->font().glyph_height();
+ int tooltip_height = glyph_height * (1 + line_count) + ((glyph_height + 1) / 2) * line_count + 8;
Gfx::IntRect desktop_rect = Desktop::the().rect();
if (tooltip_width > desktop_rect.width())