mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
WindowServer: Add WindowStack concept
This patch moves the window stack out of WindowManager and into its own WindowStack class. A WindowStack is an ordered list of windows with an optional highlight window. The highlight window mechanism is used during Super+Tab window switching to temporarily bring a window to the front. This is mostly mechanical, just moving the code to its own class.
This commit is contained in:
parent
906d3e9f44
commit
d257f58306
8 changed files with 267 additions and 197 deletions
45
Userland/Services/WindowServer/WindowStack.cpp
Normal file
45
Userland/Services/WindowServer/WindowStack.cpp
Normal file
|
@ -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>();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue