summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Window.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-06-08 19:36:27 +0430
committerAndreas Kling <kling@serenityos.org>2021-06-08 19:14:24 +0200
commit7ac196974de3a85430f4ccd1db883943853d8ae0 (patch)
treeefc838bfc282a16379e1c80b7f3e721a6eb8b297 /Userland/Libraries/LibGUI/Window.cpp
parent3d94b5051d8a783858cde04eb4d2e1ecf63ac180 (diff)
downloadserenity-7ac196974de3a85430f4ccd1db883943853d8ae0.zip
Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&>
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index 07a3de700e..66a8258e0b 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -843,13 +843,13 @@ void Window::start_interactive_resize()
WindowServerConnection::the().async_start_window_resize(m_window_id);
}
-Vector<Widget*> Window::focusable_widgets(FocusSource source) const
+Vector<Widget&> Window::focusable_widgets(FocusSource source) const
{
if (!m_main_widget)
return {};
HashTable<Widget*> seen_widgets;
- Vector<Widget*> collected_widgets;
+ Vector<Widget&> collected_widgets;
Function<void(Widget&)> collect_focusable_widgets = [&](auto& widget) {
bool widget_accepts_focus = false;
@@ -868,7 +868,7 @@ Vector<Widget*> Window::focusable_widgets(FocusSource source) const
if (widget_accepts_focus) {
auto& effective_focus_widget = widget.focus_proxy() ? *widget.focus_proxy() : widget;
if (seen_widgets.set(&effective_focus_widget) == AK::HashSetResult::InsertedNewEntry)
- collected_widgets.append(&effective_focus_widget);
+ collected_widgets.append(effective_focus_widget);
}
widget.for_each_child_widget([&](auto& child) {
if (!child.is_visible())
@@ -1056,7 +1056,7 @@ void Window::focus_a_widget_if_possible(FocusSource source)
{
auto focusable_widgets = this->focusable_widgets(source);
if (!focusable_widgets.is_empty())
- set_focused_widget(focusable_widgets[0], source);
+ set_focused_widget(&focusable_widgets[0], source);
}
void Window::did_disable_focused_widget(Badge<Widget>)