mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 15:34:58 +00:00
LibGUI: Add Widget::has_focus_within()
This returns true if the widget has focus, or if one of its descendant widgets does. Use this in StackWidget and TabWidget. This also fixes HackStudio crashing on startup in StackWidget, due to running before the window has a focused widget.
This commit is contained in:
parent
dee639f19b
commit
b11b4b29e9
4 changed files with 18 additions and 2 deletions
|
@ -43,7 +43,7 @@ void StackWidget::set_active_widget(Widget* widget)
|
|||
if (widget == m_active_widget)
|
||||
return;
|
||||
|
||||
bool active_widget_had_focus = m_active_widget && window() && (window()->focused_widget() == m_active_widget || m_active_widget->is_ancestor_of(*window()->focused_widget()));
|
||||
bool active_widget_had_focus = m_active_widget && m_active_widget->has_focus_within();
|
||||
|
||||
if (m_active_widget)
|
||||
m_active_widget->set_visible(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue