mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +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:
parent
65d94a1e74
commit
4806cd122d
3 changed files with 11 additions and 2 deletions
|
@ -761,7 +761,13 @@ void Window::set_size_increment(const Gfx::Size& size_increment)
|
|||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement>(m_window_id, m_base_size, m_size_increment);
|
||||
}
|
||||
|
||||
void Window::did_remove_widget(Badge<Widget>, const Widget& widget)
|
||||
void Window::did_add_widget(Badge<Widget>, Widget& widget)
|
||||
{
|
||||
if (!m_focused_widget && widget.accepts_focus())
|
||||
set_focused_widget(&widget);
|
||||
}
|
||||
|
||||
void Window::did_remove_widget(Badge<Widget>, Widget& widget)
|
||||
{
|
||||
if (m_focused_widget == &widget)
|
||||
m_focused_widget = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue