From 65c5901e7cfd4114989ff7248fd12e00b53b7bce Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Fri, 25 Nov 2022 10:40:33 -0500 Subject: [PATCH] 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. --- Userland/Applications/Assistant/main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 9c6fa480473..2d3b0c5c902 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -226,9 +226,7 @@ ErrorOr 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 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();