summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGUI/Widget.cpp')
-rw-r--r--Libraries/LibGUI/Widget.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp
index 7da18926c6..2719acd92d 100644
--- a/Libraries/LibGUI/Widget.cpp
+++ b/Libraries/LibGUI/Widget.cpp
@@ -499,8 +499,22 @@ void Widget::set_window(Window* window)
m_window = window;
}
+void Widget::set_focus_proxy(Widget* proxy)
+{
+ if (m_focus_proxy == proxy)
+ return;
+
+ if (proxy)
+ m_focus_proxy = proxy->make_weak_ptr();
+ else
+ m_focus_proxy = nullptr;
+}
+
bool Widget::is_focused() const
{
+ if (m_focus_proxy)
+ return m_focus_proxy->is_focused();
+
auto* win = window();
if (!win)
return false;
@@ -514,6 +528,9 @@ bool Widget::is_focused() const
void Widget::set_focus(bool focus, FocusSource source)
{
+ if (m_focus_proxy)
+ return m_focus_proxy->set_focus(focus, source);
+
auto* win = window();
if (!win)
return;