From a2bdcfabc98d34e12cbf1a967c758f8fe75cd197 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 24 Apr 2020 14:16:29 +0200 Subject: [PATCH] LibGUI: Grant focus when activating a new stack/tab child widget This makes opening a tab actually focus the opened tab. --- Libraries/LibGUI/StackWidget.cpp | 1 + Libraries/LibGUI/TabWidget.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Libraries/LibGUI/StackWidget.cpp b/Libraries/LibGUI/StackWidget.cpp index f3ac39070e..f72e26e1af 100644 --- a/Libraries/LibGUI/StackWidget.cpp +++ b/Libraries/LibGUI/StackWidget.cpp @@ -47,6 +47,7 @@ void StackWidget::set_active_widget(Widget* widget) m_active_widget = widget; if (m_active_widget) { m_active_widget->set_relative_rect(rect()); + m_active_widget->set_focus(true); m_active_widget->set_visible(true); } if (on_active_widget_change) diff --git a/Libraries/LibGUI/TabWidget.cpp b/Libraries/LibGUI/TabWidget.cpp index 06ebdb9d3e..f8f2be1566 100644 --- a/Libraries/LibGUI/TabWidget.cpp +++ b/Libraries/LibGUI/TabWidget.cpp @@ -63,6 +63,7 @@ void TabWidget::set_active_widget(Widget* widget) m_active_widget = widget; if (m_active_widget) { m_active_widget->set_relative_rect(child_rect_for_size(size())); + m_active_widget->set_focus(true); m_active_widget->set_visible(true); deferred_invoke([this](auto&) { if (on_change)