mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-19 14:03:46 +09:00
Author: https://github.com/rburchell Commit: https://github.com/SerenityOS/serenity/commit/20e55c01203 Pull-request: https://github.com/SerenityOS/serenity/pull/51
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…
Reference in a new issue