mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
LibGUI: Make StackWidget set the active widget as its focus proxy
This transparently transfers focus to the active widget whenever the stack widget is focused.
This commit is contained in:
parent
698490c565
commit
cf93c66e6e
Notes:
sideshowbarker
2024-07-19 01:38:29 +09:00
Author: https://github.com/awesomekling
Commit: cf93c66e6e
1 changed files with 5 additions and 2 deletions
|
@ -42,17 +42,20 @@ void StackWidget::set_active_widget(Widget* widget)
|
|||
if (widget == m_active_widget)
|
||||
return;
|
||||
|
||||
bool had_focus = is_focused() || (m_active_widget && m_active_widget->is_focused());
|
||||
bool active_widget_had_focus = m_active_widget && m_active_widget->is_focused();
|
||||
|
||||
if (m_active_widget)
|
||||
m_active_widget->set_visible(false);
|
||||
m_active_widget = widget;
|
||||
if (m_active_widget) {
|
||||
m_active_widget->set_relative_rect(rect());
|
||||
if (had_focus)
|
||||
if (active_widget_had_focus)
|
||||
m_active_widget->set_focus(true);
|
||||
m_active_widget->set_visible(true);
|
||||
}
|
||||
|
||||
set_focus_proxy(m_active_widget);
|
||||
|
||||
if (on_active_widget_change)
|
||||
on_active_widget_change(m_active_widget);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue