summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/Window.h
diff options
context:
space:
mode:
authorTimothy <timmot@users.noreply.github.com>2021-07-17 10:41:36 +1000
committerAndreas Kling <kling@serenityos.org>2021-07-18 17:21:28 +0200
commit9e04ab936ff7881485848d99a2a6483bff2f3e4a (patch)
treea67031b6231ac24a7c4f17dbf9d35c2a38c47ea7 /Userland/Services/WindowServer/Window.h
parentf5e0475bdf3ce85be6854713edef4b9b2b167e90 (diff)
downloadserenity-9e04ab936ff7881485848d99a2a6483bff2f3e4a.zip
WindowServer: Let clients mark windows as stealable by specific clients
This implements window stealing in WindowServer, which allows clients to mark a window they own as 'stealable' by another client. Indicating that the other client may use it for any purpose. This also updates set_window_parent_from_id so that the client must first mark its window as stealable before allowing other clients to use it as a parent.
Diffstat (limited to 'Userland/Services/WindowServer/Window.h')
-rw-r--r--Userland/Services/WindowServer/Window.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h
index 8c473c702f..b74ca9732a 100644
--- a/Userland/Services/WindowServer/Window.h
+++ b/Userland/Services/WindowServer/Window.h
@@ -362,6 +362,16 @@ public:
void set_moving_to_another_stack(bool value) { m_moving_to_another_stack = value; }
bool is_moving_to_another_stack() const { return m_moving_to_another_stack; }
+ void add_stealing_for_client(i32 client_id) { m_stealable_by_client_ids.append(move(client_id)); }
+ void remove_stealing_for_client(i32 client_id)
+ {
+ m_stealable_by_client_ids.remove_all_matching([client_id](i32 approved_client_id) {
+ return approved_client_id == client_id;
+ });
+ }
+ void remove_all_stealing() { m_stealable_by_client_ids.clear(); }
+ bool is_stealable_by_client(i32 client_id) const { return m_stealable_by_client_ids.contains_slow(client_id); }
+
private:
Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window = nullptr);
Window(Core::Object&, WindowType);
@@ -418,6 +428,7 @@ private:
bool m_pinned { false };
bool m_moving_to_another_stack { false };
bool m_invalidate_last_render_rects { false };
+ Vector<i32> m_stealable_by_client_ids;
WindowTileType m_tiled { WindowTileType::None };
Gfx::IntRect m_untiled_rect;
bool m_occluded { false };