diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-06-03 03:23:01 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-03 13:27:40 +0200 |
commit | d0dbb014a027b868ad2a76a4544e31e27704f541 (patch) | |
tree | ca358c1ae34fe0e8628b7c7dda9b6918ebf5c6c3 /Userland/Services/WindowServer/WindowManager.h | |
parent | 7e691f96e1e1d881ea698280868be75814e7f33d (diff) | |
download | serenity-d0dbb014a027b868ad2a76a4544e31e27704f541.zip |
WindowServer: Switch Window to IntrusiveList from InlineLinkedList
Another small step towards unifying IntrusiveList / InlineLinkedList.
Diffstat (limited to 'Userland/Services/WindowServer/WindowManager.h')
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index 36b7378e40..4bd6ceabc7 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -284,7 +284,7 @@ private: RefPtr<Cursor> m_wait_cursor; RefPtr<Cursor> m_crosshair_cursor; - InlineLinkedList<Window> m_windows_in_order; + Window::List m_windows_in_order; struct DoubleClickInfo { struct ClickMetadata { @@ -411,16 +411,18 @@ IterationDecision WindowManager::for_each_visible_window_of_type_from_front_to_b return IterationDecision::Break; } - for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { - if (!window->is_visible()) + auto reverse_iterator = m_windows_in_order.rbegin(); + for (; reverse_iterator != m_windows_in_order.rend(); ++reverse_iterator) { + auto& window = *reverse_iterator; + if (!window.is_visible()) continue; - if (window->is_minimized()) + if (window.is_minimized()) continue; - if (window->type() != type) + if (window.type() != type) continue; - if (!ignore_highlight && window == m_highlight_window) + if (!ignore_highlight && &window == m_highlight_window) continue; - if (callback(*window) == IterationDecision::Break) + if (callback(window) == IterationDecision::Break) return IterationDecision::Break; } return IterationDecision::Continue; @@ -463,8 +465,10 @@ void WindowManager::for_each_window_manager(Callback callback) template<typename Callback> void WindowManager::for_each_window(Callback callback) { - for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { - if (callback(*window) == IterationDecision::Break) + auto reverse_iterator = m_windows_in_order.rbegin(); + for (; reverse_iterator != m_windows_in_order.rend(); ++reverse_iterator) { + auto& window = *reverse_iterator; + if (callback(window) == IterationDecision::Break) return; } } @@ -477,12 +481,14 @@ IterationDecision WindowManager::for_each_window_of_type_from_front_to_back(Wind return IterationDecision::Break; } - for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { - if (window->type() != type) + auto reverse_iterator = m_windows_in_order.rbegin(); + for (; reverse_iterator != m_windows_in_order.rend(); ++reverse_iterator) { + auto& window = *reverse_iterator; + if (window.type() != type) continue; - if (!ignore_highlight && window == m_highlight_window) + if (!ignore_highlight && &window == m_highlight_window) continue; - if (callback(*window) == IterationDecision::Break) + if (callback(window) == IterationDecision::Break) return IterationDecision::Break; } return IterationDecision::Continue; |