summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authordemostanis <demostanis@protonmail.com>2022-10-09 10:57:44 +0200
committerSam Atkins <atkinssj@gmail.com>2022-10-13 12:37:54 +0100
commit63a18aa89e24b3ba4e598f99a6422ccefb4d6a08 (patch)
treeb1fa82918f5e69ff9c2c8b0a67b2f27710d2ac0e /Userland
parent50e74de279b62a7df8a913f602d3124a895f51fc (diff)
downloadserenity-63a18aa89e24b3ba4e598f99a6422ccefb4d6a08.zip
LibGUI+WindowServer: Add Window::set_always_on_top()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp7
-rw-r--r--Userland/Libraries/LibGUI/Window.h2
-rw-r--r--Userland/Services/WindowServer/ConnectionFromClient.cpp9
-rw-r--r--Userland/Services/WindowServer/ConnectionFromClient.h1
-rw-r--r--Userland/Services/WindowServer/WindowServer.ipc2
5 files changed, 21 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index a7f642b1ba..84ac0f610b 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -1281,4 +1281,11 @@ void Window::flush_pending_paints_immediately()
handle_multi_paint_event(paint_event);
}
+void Window::set_always_on_top(bool always_on_top)
+{
+ if (!m_window_id)
+ return;
+ ConnectionToWindowServer::the().set_always_on_top(m_window_id, always_on_top);
+}
+
}
diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h
index 4a45d3d299..47834a8cae 100644
--- a/Userland/Libraries/LibGUI/Window.h
+++ b/Userland/Libraries/LibGUI/Window.h
@@ -232,6 +232,8 @@ public:
void set_blocks_emoji_input(bool b) { m_blocks_emoji_input = b; }
bool blocks_emoji_input() const { return m_blocks_emoji_input; }
+ void set_always_on_top(bool always_on_top = true);
+
protected:
Window(Core::Object* parent = nullptr);
virtual void wm_event(WMEvent&);
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp
index ec43090927..43e2e8bd97 100644
--- a/Userland/Services/WindowServer/ConnectionFromClient.cpp
+++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp
@@ -1341,6 +1341,15 @@ void ConnectionFromClient::remove_window_stealing(i32 window_id)
window->remove_all_stealing();
}
+void ConnectionFromClient::set_always_on_top(i32 window_id, bool always_on_top)
+{
+ auto window = window_from_id(window_id);
+ if (!window)
+ did_misbehave("SetAlwaysOnTop: Bad window ID");
+
+ window->set_always_on_top(always_on_top);
+}
+
void ConnectionFromClient::notify_about_theme_change()
{
// Recalculate minimum size for each window, using the new theme metrics.
diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h
index 7f431dbbd1..211da366ed 100644
--- a/Userland/Services/WindowServer/ConnectionFromClient.h
+++ b/Userland/Services/WindowServer/ConnectionFromClient.h
@@ -185,6 +185,7 @@ private:
virtual void add_window_stealing_for_client(i32, i32) override;
virtual void remove_window_stealing_for_client(i32, i32) override;
virtual void remove_window_stealing(i32) override;
+ virtual void set_always_on_top(i32, bool) override;
virtual Messages::WindowServer::GetColorUnderCursorResponse get_color_under_cursor() override;
Window* window_from_id(i32 window_id);
diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc
index 867586b897..111a4ab83c 100644
--- a/Userland/Services/WindowServer/WindowServer.ipc
+++ b/Userland/Services/WindowServer/WindowServer.ipc
@@ -182,4 +182,6 @@ endpoint WindowServer
add_window_stealing_for_client(i32 client_id, i32 window_id) => ()
remove_window_stealing_for_client(i32 client_id, i32 window_id) => ()
remove_window_stealing(i32 window_id) => ()
+
+ set_always_on_top(i32 window_id, bool always_on_top) => ()
}