mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 17:15:06 +00:00
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.
This commit is contained in:
parent
77dfd419e9
commit
20e55c0120
1 changed files with 3 additions and 1 deletions
|
@ -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<GBoxLayout>(Orientation::Vertical));
|
||||
widget->set_fill_with_background_color(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue