summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-30 22:41:14 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-30 23:43:24 +0200
commit9bbc1c9c930157ba89eb0c3554a67bf4bd6fe7cb (patch)
treeaa489410241d0cc35f653e28bbc2250d6b6a871d /Userland/Libraries/LibGUI
parent44602ae1413dc374e7590dab738944e4e07a653d (diff)
downloadserenity-9bbc1c9c930157ba89eb0c3554a67bf4bd6fe7cb.zip
WindowServer+Taskbar: Show applets in taskbar :^)
WindowServer now collects applet windows into an "applet area" which is really just a window that a WM (window management) client can position via IPC. This is rather hackish, and I think we should come up with a better architecture eventually, but this brings back the missing applets since the global menu where they used to live is gone.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/Event.h15
-rw-r--r--Userland/Libraries/LibGUI/WindowServerConnection.cpp6
-rw-r--r--Userland/Libraries/LibGUI/WindowServerConnection.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h
index b8898f7bde..0841e2026d 100644
--- a/Userland/Libraries/LibGUI/Event.h
+++ b/Userland/Libraries/LibGUI/Event.h
@@ -77,6 +77,7 @@ public:
WM_WindowStateChanged,
WM_WindowRectChanged,
WM_WindowIconBitmapChanged,
+ WM_AppletAreaSizeChanged,
__End_WM_Events,
};
@@ -108,6 +109,20 @@ private:
int m_window_id { -1 };
};
+class WMAppletAreaSizeChangedEvent : public WMEvent {
+public:
+ explicit WMAppletAreaSizeChangedEvent(const Gfx::IntSize& size)
+ : WMEvent(Event::Type::WM_AppletAreaSizeChanged, 0, 0)
+ , m_size(size)
+ {
+ }
+
+ const Gfx::IntSize& size() const { return m_size; }
+
+private:
+ Gfx::IntSize m_size;
+};
+
class WMWindowRemovedEvent : public WMEvent {
public:
WMWindowRemovedEvent(int client_id, int window_id)
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp
index aa819cc850..847c6febab 100644
--- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp
+++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp
@@ -269,6 +269,12 @@ void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowState
Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(message.client_id(), message.window_id(), message.parent_client_id(), message.parent_window_id(), message.title(), message.rect(), message.is_active(), message.is_modal(), static_cast<WindowType>(message.window_type()), message.is_minimized(), message.is_frameless(), message.progress()));
}
+void WindowServerConnection::handle(const Messages::WindowClient::WM_AppletAreaSizeChanged& message)
+{
+ if (auto* window = Window::from_window_id(message.wm_id()))
+ Core::EventLoop::current().post_event(*window, make<WMAppletAreaSizeChangedEvent>(message.size()));
+}
+
void WindowServerConnection::handle(const Messages::WindowClient::WM_WindowRectChanged& message)
{
if (auto* window = Window::from_window_id(message.wm_id()))
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.h b/Userland/Libraries/LibGUI/WindowServerConnection.h
index 49850e3839..4e9a29e649 100644
--- a/Userland/Libraries/LibGUI/WindowServerConnection.h
+++ b/Userland/Libraries/LibGUI/WindowServerConnection.h
@@ -69,6 +69,7 @@ private:
virtual void handle(const Messages::WindowClient::WM_WindowStateChanged&) override;
virtual void handle(const Messages::WindowClient::WM_WindowIconBitmapChanged&) override;
virtual void handle(const Messages::WindowClient::WM_WindowRectChanged&) override;
+ virtual void handle(const Messages::WindowClient::WM_AppletAreaSizeChanged&) override;
virtual void handle(const Messages::WindowClient::AsyncSetWallpaperFinished&) override;
virtual void handle(const Messages::WindowClient::DragDropped&) override;
virtual void handle(const Messages::WindowClient::DragAccepted&) override;