From 20e55c01203147869e30afffde0cc3d34c947ba6 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 17 May 2019 15:49:06 +0200 Subject: [PATCH] GInputBox: Use whichever is greater: the approximate size of the title, or the label's text Might be an idea to add a minimum size constrain in window server instead, since it knows the exact dimensions? But this is a simple fix that seems to do the job. --- LibGUI/GInputBox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LibGUI/GInputBox.cpp b/LibGUI/GInputBox.cpp index cc08772f1b0..8315d210977 100644 --- a/LibGUI/GInputBox.cpp +++ b/LibGUI/GInputBox.cpp @@ -23,8 +23,10 @@ void GInputBox::build() set_main_widget(widget); int text_width = widget->font().width(m_prompt); + int title_width = widget->font().width(title()) + 24 /* icon, plus a little padding -- not perfect */; + int max_width = AK::max(text_width, title_width); - set_rect(x(), y(), text_width + 80, 80); + set_rect(x(), y(), max_width + 80, 80); widget->set_layout(make(Orientation::Vertical)); widget->set_fill_with_background_color(true);