From 2b37fad60b6cc1f247ac56afeeecb4350ed22da6 Mon Sep 17 00:00:00 2001 From: Peter Elliott Date: Sun, 18 Jul 2021 12:42:53 -0600 Subject: WindowServer: Add set_virtual_dekstop WindowManager message Users can specify the row and column of the virtual desktop, and WindowServer will animate to it. --- Userland/Services/WindowServer/WMClientConnection.cpp | 5 +++++ Userland/Services/WindowServer/WMClientConnection.h | 1 + Userland/Services/WindowServer/WindowManager.h | 5 +++++ Userland/Services/WindowServer/WindowManagerServer.ipc | 1 + 4 files changed, 12 insertions(+) diff --git a/Userland/Services/WindowServer/WMClientConnection.cpp b/Userland/Services/WindowServer/WMClientConnection.cpp index b34798e360..9aaba46b64 100644 --- a/Userland/Services/WindowServer/WMClientConnection.cpp +++ b/Userland/Services/WindowServer/WMClientConnection.cpp @@ -154,6 +154,11 @@ void WMClientConnection::set_manager_window(i32 window_id) WindowManager::the().greet_window_manager(*this); } +void WMClientConnection::set_virtual_desktop(u32 row, u32 col) +{ + WindowManager::the().switch_to_window_stack(row, col); +} + void WMClientConnection::set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect const& rect) { // Because the Taskbar (which should be the only user of this API) does not own the diff --git a/Userland/Services/WindowServer/WMClientConnection.h b/Userland/Services/WindowServer/WMClientConnection.h index dfa4389201..834b733f30 100644 --- a/Userland/Services/WindowServer/WMClientConnection.h +++ b/Userland/Services/WindowServer/WMClientConnection.h @@ -30,6 +30,7 @@ public: virtual void set_applet_area_position(Gfx::IntPoint const&) override; virtual void set_event_mask(u32) override; virtual void set_manager_window(i32) override; + virtual void set_virtual_desktop(u32, u32) override; unsigned event_mask() const { return m_event_mask; } int window_id() const { return m_window_id; } diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index 58024814ad..5cd81a2f43 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -263,6 +263,11 @@ public: Window* hovered_window() const { return m_hovered_window.ptr(); } void switch_to_window_stack(WindowStack&, Window* = nullptr, bool show_overlay = true); + void switch_to_window_stack(u32 row, u32 col, Window* carry = nullptr, bool show_overlay = true) + { + if (row < window_stack_rows() && col < window_stack_columns()) + switch_to_window_stack(m_window_stacks[row][col], carry, show_overlay); + } size_t window_stack_rows() const { return m_window_stacks.size(); } size_t window_stack_columns() const { return m_window_stacks[0].size(); } diff --git a/Userland/Services/WindowServer/WindowManagerServer.ipc b/Userland/Services/WindowServer/WindowManagerServer.ipc index b572e390e3..fa3e4c6cd4 100644 --- a/Userland/Services/WindowServer/WindowManagerServer.ipc +++ b/Userland/Services/WindowServer/WindowManagerServer.ipc @@ -12,4 +12,5 @@ endpoint WindowManagerServer popup_window_menu(i32 client_id, i32 window_id, Gfx::IntPoint screen_position) =| set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect rect) =| set_applet_area_position(Gfx::IntPoint position) =| + set_virtual_desktop(u32 row, u32 column) =| } -- cgit v1.2.3