summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-02-20 23:10:21 -0700
committerAndreas Kling <kling@serenityos.org>2021-02-21 10:33:28 +0100
commit1c31bcb24e4b701be373f6dad567a554535fb492 (patch)
treea1ff1cc0f446e91966fd75ac37ba5028021deb0d /Userland
parent368fe0f7f80bfcb8a81ff2bde01d017f2ba26aae (diff)
downloadserenity-1c31bcb24e4b701be373f6dad567a554535fb492.zip
WindowServer: Allow changing frameless state after a window is created
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp10
-rw-r--r--Userland/Libraries/LibGUI/Window.h2
-rw-r--r--Userland/Services/WindowServer/ClientConnection.cpp12
-rw-r--r--Userland/Services/WindowServer/ClientConnection.h1
-rw-r--r--Userland/Services/WindowServer/Window.cpp13
-rw-r--r--Userland/Services/WindowServer/Window.h2
-rw-r--r--Userland/Services/WindowServer/WindowServer.ipc1
7 files changed, 39 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index 7ba7de901d..92ebd89e2f 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -871,6 +871,16 @@ void Window::set_fullscreen(bool fullscreen)
WindowServerConnection::the().send_sync<Messages::WindowServer::SetFullscreen>(m_window_id, fullscreen);
}
+void Window::set_frameless(bool frameless)
+{
+ if (m_frameless == frameless)
+ return;
+ m_frameless = frameless;
+ if (!is_visible())
+ return;
+ WindowServerConnection::the().send_sync<Messages::WindowServer::SetFrameless>(m_window_id, frameless);
+}
+
bool Window::is_maximized() const
{
if (!is_visible())
diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h
index 50843e5d78..516a07b100 100644
--- a/Userland/Libraries/LibGUI/Window.h
+++ b/Userland/Libraries/LibGUI/Window.h
@@ -58,7 +58,7 @@ public:
bool is_maximized() const;
bool is_frameless() const { return m_frameless; }
- void set_frameless(bool frameless) { m_frameless = frameless; }
+ void set_frameless(bool);
bool is_resizable() const { return m_resizable; }
void set_resizable(bool resizable) { m_resizable = resizable; }
diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp
index b83461678c..2626d9c4fb 100644
--- a/Userland/Services/WindowServer/ClientConnection.cpp
+++ b/Userland/Services/WindowServer/ClientConnection.cpp
@@ -286,6 +286,18 @@ OwnPtr<Messages::WindowServer::SetFullscreenResponse> ClientConnection::handle(c
return make<Messages::WindowServer::SetFullscreenResponse>();
}
+OwnPtr<Messages::WindowServer::SetFramelessResponse> ClientConnection::handle(const Messages::WindowServer::SetFrameless& message)
+{
+ auto it = m_windows.find(message.window_id());
+ if (it == m_windows.end()) {
+ did_misbehave("SetFrameless: Bad window ID");
+ return {};
+ }
+ it->value->set_frameless(message.frameless());
+ WindowManager::the().tell_wm_listeners_window_state_changed(*it->value);
+ return make<Messages::WindowServer::SetFramelessResponse>();
+}
+
OwnPtr<Messages::WindowServer::SetWindowOpacityResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowOpacity& message)
{
auto it = m_windows.find(message.window_id());
diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ClientConnection.h
index 767507e3f9..9b4e4d7742 100644
--- a/Userland/Services/WindowServer/ClientConnection.h
+++ b/Userland/Services/WindowServer/ClientConnection.h
@@ -125,6 +125,7 @@ private:
virtual OwnPtr<Messages::WindowServer::SetWindowAlphaHitThresholdResponse> handle(const Messages::WindowServer::SetWindowAlphaHitThreshold&) override;
virtual OwnPtr<Messages::WindowServer::MoveWindowToFrontResponse> handle(const Messages::WindowServer::MoveWindowToFront&) override;
virtual OwnPtr<Messages::WindowServer::SetFullscreenResponse> handle(const Messages::WindowServer::SetFullscreen&) override;
+ virtual OwnPtr<Messages::WindowServer::SetFramelessResponse> handle(const Messages::WindowServer::SetFrameless&) override;
virtual void handle(const Messages::WindowServer::AsyncSetWallpaper&) override;
virtual OwnPtr<Messages::WindowServer::SetBackgroundColorResponse> handle(const Messages::WindowServer::SetBackgroundColor&) override;
virtual OwnPtr<Messages::WindowServer::SetWallpaperModeResponse> handle(const Messages::WindowServer::SetWallpaperMode&) override;
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 8887125f6c..29cbc6ea98 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -500,6 +500,19 @@ void Window::set_visible(bool b)
Compositor::the().invalidate_screen(frame().render_rect());
}
+void Window::set_frameless(bool frameless)
+{
+ if (m_frameless == frameless)
+ return;
+ auto render_rect_before = frame().render_rect();
+ m_frameless = frameless;
+ if (m_visible) {
+ Compositor::the().invalidate_occlusions();
+ invalidate(true, true);
+ Compositor::the().invalidate_screen(frameless ? render_rect_before : frame().render_rect());
+ }
+}
+
void Window::invalidate(bool invalidate_frame, bool re_render_frame)
{
m_invalidated = true;
diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h
index 977b9190a4..7d5891196e 100644
--- a/Userland/Services/WindowServer/Window.h
+++ b/Userland/Services/WindowServer/Window.h
@@ -299,7 +299,7 @@ public:
bool is_accessory() const;
bool is_accessory_of(Window&) const;
- void set_frameless(bool frameless) { m_frameless = frameless; }
+ void set_frameless(bool);
bool is_frameless() const { return m_frameless; }
int progress() const { return m_progress; }
diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc
index f6a88ee52e..b908be52f6 100644
--- a/Userland/Services/WindowServer/WindowServer.ipc
+++ b/Userland/Services/WindowServer/WindowServer.ipc
@@ -88,6 +88,7 @@ endpoint WindowServer = 2
SetWindowHasAlphaChannel(i32 window_id, bool has_alpha_channel) => ()
MoveWindowToFront(i32 window_id) => ()
SetFullscreen(i32 window_id, bool fullscreen) => ()
+ SetFrameless(i32 window_id, bool frameless) => ()
PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => ()
DismissMenu(i32 menu_id) => ()