diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2021-07-18 12:42:53 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-19 18:21:40 +0200 |
commit | 2b37fad60b6cc1f247ac56afeeecb4350ed22da6 (patch) | |
tree | a244f183f7189d3134a6f9cdbc5974872e46f977 | |
parent | b8f34413000ec9ad2439cbab83420966a7e68c00 (diff) | |
download | serenity-2b37fad60b6cc1f247ac56afeeecb4350ed22da6.zip |
WindowServer: Add set_virtual_dekstop WindowManager message
Users can specify the row and column of the virtual desktop, and
WindowServer will animate to it.
4 files changed, 12 insertions, 0 deletions
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) =| } |