diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-11-25 10:40:33 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-26 18:11:51 +0100 |
commit | 65c5901e7cfd4114989ff7248fd12e00b53b7bce (patch) | |
tree | 7a325be3f758527c15789b114bc16de63ed8d3c1 | |
parent | 518964e7c750513ee1394ebd5f46ed18aa85a7cc (diff) | |
download | serenity-65c5901e7cfd4114989ff7248fd12e00b53b7bce.zip |
Assistant: Automatically compute Assistant's window dimensions
Disregarding minimum widget size was originally set as a quick fix
when converting Assistant to a Popup window, but it's really much
easier to let layout manage dynamic resizing instead of trying to
add up pixels piecemeal.
-rw-r--r-- | Userland/Applications/Assistant/main.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 9c6fa48047..2d3b0c5c90 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -226,9 +226,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } mark_selected_item(); - - auto window_height = app_state.visible_result_count * 40 + text_box.height() + 28; - window->resize(GUI::Desktop::the().rect().width() / 3, window_height); + Core::deferred_invoke([&] { window->resize(GUI::Desktop::the().rect().width() / 3, {}); }); }); db.on_new_results = [&](auto results) { @@ -243,9 +241,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) }; window->set_window_type(GUI::WindowType::Popup); - window->set_obey_widget_min_size(false); window->set_forced_shadow(true); - window->resize(GUI::Desktop::the().rect().width() / 3, 46); + window->resize(GUI::Desktop::the().rect().width() / 3, {}); window->center_on_screen(); window->move_to(window->x(), window->y() - (GUI::Desktop::the().rect().height() * 0.33)); window->show(); |