1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

WindowServer: Add API to change virtual desktop settings

This also adds the ability to query how many virtual desktops are
set up, and for the Taskbar to be notified when the active virtual
desktop has changed.
This commit is contained in:
Tom 2021-06-30 19:12:02 -06:00 committed by Andreas Kling
parent 584b144953
commit 7984c2836d
21 changed files with 383 additions and 64 deletions

View file

@ -26,6 +26,13 @@ void WindowStack::add(Window& window)
window.set_outer_stack({}, this);
}
void WindowStack::add_to_back(Window& window)
{
VERIFY(window.outer_stack() == nullptr);
m_windows.prepend(window);
window.set_outer_stack({}, this);
}
void WindowStack::remove(Window& window)
{
VERIFY(window.outer_stack() == this);
@ -47,6 +54,27 @@ void WindowStack::move_to_front(Window& window)
m_windows.append(window);
}
void WindowStack::move_all_windows(WindowStack& new_window_stack, Vector<Window*, 32>& windows_moved, MoveAllWindowsTo move_to)
{
VERIFY(this != &new_window_stack);
if (move_to == MoveAllWindowsTo::Front) {
while (auto* window = m_windows.take_first()) {
window->set_outer_stack({}, nullptr);
new_window_stack.add(*window);
windows_moved.append(window);
}
} else {
while (auto* window = m_windows.take_last()) {
window->set_outer_stack({}, nullptr);
new_window_stack.add_to_back(*window);
windows_moved.append(window);
}
}
m_active_window = nullptr;
m_active_input_window = nullptr;
m_active_input_tracking_window = nullptr;
}
Window* WindowStack::window_at(Gfx::IntPoint const& position, IncludeWindowFrame include_window_frame) const
{
auto result = hit_test(position);