Commit graph

9 commits

Author SHA1 Message Date
Andreas Kling
b11b4b29e9 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.
2020-10-30 23:40:23 +01:00
Andreas Kling
dee639f19b LibGUI: Improve TabWidget+StackWidget focus behavior further
When setting a new active widget, transfer focus if it's anywhere in
the old active widget's tree, not just at the immediate child.
2020-10-30 19:17:09 +01:00
Andreas Kling
0b798a50dc 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().
2020-10-30 17:03:29 +01:00
Andreas Kling
cf93c66e6e LibGUI: Make StackWidget set the active widget as its focus proxy
This transparently transfers focus to the active widget whenever the
stack widget is focused.
2020-10-30 17:03:29 +01:00
Andreas Kling
9b89303767 LibGUI: StackWidget should not steal focus when switching active child
Only focus the new active child if the old one had focus previously.
2020-09-18 21:29:01 +02:00
Andreas Kling
e0b8b4ac67 LibCore+LibGUI: Switch to using AK::is and AK::downcast 2020-07-26 17:51:00 +02:00
Andreas Kling
a2bdcfabc9 LibGUI: Grant focus when activating a new stack/tab child widget
This makes opening a tab actually focus the opened tab.
2020-04-24 14:34:24 +02:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Renamed from Libraries/LibGUI/GStackWidget.cpp (Browse further)