LibGUI: Make GWindow drive relayout and do it recursively

Instead of only doing a relayout in the widget you're invalidating,
we now do a recursive top-down relayout so everything gets updated.

This fixes invalid results after updating a preferred size in some
situations with nested layouts.
This commit is contained in:
Andreas Kling 2019-10-26 12:27:01 +02:00
parent d0799f3648
commit 98a6149b4f
Notes: sideshowbarker 2024-07-19 11:32:20 +09:00
4 changed files with 24 additions and 14 deletions

View file

@ -736,3 +736,16 @@ void GWindow::set_fullscreen(bool fullscreen)
request.value = fullscreen;
GWindowServerConnection::the().sync_request(request, WSAPI_ServerMessage::Type::DidSetFullscreen);
}
void GWindow::schedule_relayout()
{
if (m_layout_pending)
return;
m_layout_pending = true;
deferred_invoke([this](auto&) {
if (main_widget())
main_widget()->do_layout();
update();
m_layout_pending = false;
});
}