Skip to content

Commit 65c5901

Browse files
thankyouverycoolawesomekling
authored andcommitted
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.
1 parent 518964e commit 65c5901

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Userland/Applications/Assistant/main.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
226226
}
227227

228228
mark_selected_item();
229-
230-
auto window_height = app_state.visible_result_count * 40 + text_box.height() + 28;
231-
window->resize(GUI::Desktop::the().rect().width() / 3, window_height);
229+
Core::deferred_invoke([&] { window->resize(GUI::Desktop::the().rect().width() / 3, {}); });
232230
});
233231

234232
db.on_new_results = [&](auto results) {
@@ -243,9 +241,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
243241
};
244242

245243
window->set_window_type(GUI::WindowType::Popup);
246-
window->set_obey_widget_min_size(false);
247244
window->set_forced_shadow(true);
248-
window->resize(GUI::Desktop::the().rect().width() / 3, 46);
245+
window->resize(GUI::Desktop::the().rect().width() / 3, {});
249246
window->center_on_screen();
250247
window->move_to(window->x(), window->y() - (GUI::Desktop::the().rect().height() * 0.33));
251248
window->show();

0 commit comments

Comments
 (0)