summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/WindowStack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Services/WindowServer/WindowStack.cpp')
-rw-r--r--Userland/Services/WindowServer/WindowStack.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/WindowStack.cpp b/Userland/Services/WindowServer/WindowStack.cpp
new file mode 100644
index 0000000000..324e11fa4c
--- /dev/null
+++ b/Userland/Services/WindowServer/WindowStack.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include "WindowStack.h"
+
+namespace WindowServer {
+
+WindowStack::WindowStack()
+{
+}
+
+WindowStack::~WindowStack()
+{
+}
+
+void WindowStack::add(Window& window)
+{
+ m_windows.append(window);
+}
+
+void WindowStack::remove(Window& window)
+{
+ m_windows.remove(window);
+}
+
+void WindowStack::move_to_front(Window& window)
+{
+ if (m_windows.last() != &window)
+ window.invalidate();
+ m_windows.remove(window);
+ m_windows.append(window);
+}
+
+void WindowStack::set_highlight_window(Window* window)
+{
+ if (!window)
+ m_highlight_window = nullptr;
+ else
+ m_highlight_window = window->make_weak_ptr<Window>();
+}
+
+}