mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 17:27:35 +00:00
LibGUI: Make StackWidget/TabWidget preserve focus in inactive windows
This one is a bit sketchy. While a window is inactive, none of its widgets are considered focused (Widget::is_focused() will return false) but this caused programmatic changes of the active widget in a tab or stack widget to fail focus propagation from old child to new child. Work around this by checking against Window::focused_widget() directly instead of asking Widget::is_focused().
This commit is contained in:
parent
cf93c66e6e
commit
0b798a50dc
2 changed files with 4 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/StackWidget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -42,7 +43,7 @@ void StackWidget::set_active_widget(Widget* widget)
|
|||
if (widget == m_active_widget)
|
||||
return;
|
||||
|
||||
bool active_widget_had_focus = m_active_widget && m_active_widget->is_focused();
|
||||
bool active_widget_had_focus = m_active_widget && window() && window()->focused_widget() == m_active_widget;
|
||||
|
||||
if (m_active_widget)
|
||||
m_active_widget->set_visible(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue