1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 04:17:34 +00:00

LibGUI: Focus the first focusable widget added to a window

It feels really awkward if nothing is focused when opening a window.
This commit is contained in:
Andreas Kling 2020-05-21 17:26:09 +02:00
parent 65d94a1e74
commit 4806cd122d
3 changed files with 11 additions and 2 deletions

View file

@ -115,6 +115,8 @@ void Widget::child_event(Core::ChildEvent& event)
else
layout()->add_widget(Core::to<Widget>(*event.child()));
}
if (window() && event.child() && Core::is<Widget>(*event.child()))
window()->did_add_widget({}, Core::to<Widget>(*event.child()));
}
if (event.type() == Event::ChildRemoved) {
if (layout()) {