mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
@@ -29,6 +29,7 @@
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
@@ -81,7 +82,7 @@ void TabWidget::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);
|
||||
|
||||
Reference in New Issue
Block a user