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.
This commit is contained in:
thankyouverycool 2022-11-25 10:40:33 -05:00 committed by Andreas Kling
parent 518964e7c7
commit 65c5901e7c
Notes: sideshowbarker 2024-07-17 05:58:46 +09:00

View file

@ -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();