summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibGUI/Event.h15
-rw-r--r--Userland/Libraries/LibGUI/Forward.h1
-rw-r--r--Userland/Libraries/LibGUI/Widget.cpp6
-rw-r--r--Userland/Libraries/LibGUI/Widget.h1
-rw-r--r--Userland/Libraries/LibGUI/Window.cpp23
-rw-r--r--Userland/Libraries/LibGUI/Window.h2
-rw-r--r--Userland/Libraries/LibGUI/WindowServerConnection.cpp7
-rw-r--r--Userland/Libraries/LibGUI/WindowServerConnection.h1
-rw-r--r--Userland/Services/WindowServer/WMClientConnection.cpp4
-rw-r--r--Userland/Services/WindowServer/WindowClient.ipc2
10 files changed, 62 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h
index e2a0cd520b..8a2b732773 100644
--- a/Userland/Libraries/LibGUI/Event.h
+++ b/Userland/Libraries/LibGUI/Event.h
@@ -56,6 +56,7 @@ public:
ScreenRectsChange,
ActionEnter,
ActionLeave,
+ AppletAreaRectChange,
__Begin_WM_Events,
WM_WindowRemoved,
@@ -451,6 +452,20 @@ private:
size_t m_main_screen_index;
};
+class AppletAreaRectChangeEvent final : public Event {
+public:
+ explicit AppletAreaRectChangeEvent(Gfx::IntRect rect)
+ : Event(Type::AppletAreaRectChange)
+ , m_rect(rect)
+ {
+ }
+
+ Gfx::IntRect rect() const { return m_rect; }
+
+private:
+ Gfx::IntRect const m_rect;
+};
+
class FocusEvent final : public Event {
public:
explicit FocusEvent(Type type, FocusSource source)
diff --git a/Userland/Libraries/LibGUI/Forward.h b/Userland/Libraries/LibGUI/Forward.h
index 21e0c77f06..ac629e035f 100644
--- a/Userland/Libraries/LibGUI/Forward.h
+++ b/Userland/Libraries/LibGUI/Forward.h
@@ -13,6 +13,7 @@ class AbstractTableView;
class AbstractView;
class Action;
class ActionGroup;
+class AppletAreaRectChangeEvent;
class Application;
class AutocompleteBox;
class AutocompleteProvider;
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp
index 52bb229f5c..71362ff939 100644
--- a/Userland/Libraries/LibGUI/Widget.cpp
+++ b/Userland/Libraries/LibGUI/Widget.cpp
@@ -305,6 +305,8 @@ void Widget::event(Core::Event& event)
return change_event(static_cast<Event&>(event));
case Event::ContextMenu:
return context_menu_event(static_cast<ContextMenuEvent&>(event));
+ case Event::AppletAreaRectChange:
+ return applet_area_rect_change_event(static_cast<AppletAreaRectChangeEvent&>(event));
default:
return Core::Object::event(event);
}
@@ -579,6 +581,10 @@ void Widget::screen_rects_change_event(ScreenRectsChangeEvent&)
{
}
+void Widget::applet_area_rect_change_event(AppletAreaRectChangeEvent&)
+{
+}
+
void Widget::update()
{
if (rect().is_empty())
diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h
index 86b353b5a0..d88a70dfec 100644
--- a/Userland/Libraries/LibGUI/Widget.h
+++ b/Userland/Libraries/LibGUI/Widget.h
@@ -319,6 +319,7 @@ protected:
virtual void theme_change_event(ThemeChangeEvent&);
virtual void fonts_change_event(FontsChangeEvent&);
virtual void screen_rects_change_event(ScreenRectsChangeEvent&);
+ virtual void applet_area_rect_change_event(AppletAreaRectChangeEvent&);
virtual void did_begin_inspection() override;
virtual void did_end_inspection() override;
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp
index 3156e0f04f..3d926eabd1 100644
--- a/Userland/Libraries/LibGUI/Window.cpp
+++ b/Userland/Libraries/LibGUI/Window.cpp
@@ -550,6 +550,22 @@ void Window::handle_screen_rects_change_event(ScreenRectsChangeEvent& event)
screen_rects_change_event(event);
}
+void Window::handle_applet_area_rect_change_event(AppletAreaRectChangeEvent& event)
+{
+ if (!m_main_widget)
+ return;
+ auto dispatch_applet_area_rect_change = [&](auto& widget, auto recursive) {
+ widget.dispatch_event(event, this);
+ widget.for_each_child_widget([&](auto& widget) -> IterationDecision {
+ widget.dispatch_event(event, this);
+ recursive(widget, recursive);
+ return IterationDecision::Continue;
+ });
+ };
+ dispatch_applet_area_rect_change(*m_main_widget.ptr(), dispatch_applet_area_rect_change);
+ applet_area_rect_change_event(event);
+}
+
void Window::handle_drag_move_event(DragEvent& event)
{
if (!m_main_widget)
@@ -640,6 +656,9 @@ void Window::event(Core::Event& event)
if (event.type() == Event::ScreenRectsChange)
return handle_screen_rects_change_event(static_cast<ScreenRectsChangeEvent&>(event));
+ if (event.type() == Event::AppletAreaRectChange)
+ return handle_applet_area_rect_change_event(static_cast<AppletAreaRectChangeEvent&>(event));
+
Core::Object::event(event);
}
@@ -878,6 +897,10 @@ void Window::screen_rects_change_event(ScreenRectsChangeEvent&)
{
}
+void Window::applet_area_rect_change_event(AppletAreaRectChangeEvent&)
+{
+}
+
void Window::set_icon(const Gfx::Bitmap* icon)
{
if (m_icon == icon)
diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h
index a6d5b3db8b..013bb4fbe3 100644
--- a/Userland/Libraries/LibGUI/Window.h
+++ b/Userland/Libraries/LibGUI/Window.h
@@ -207,6 +207,7 @@ protected:
Window(Core::Object* parent = nullptr);
virtual void wm_event(WMEvent&);
virtual void screen_rects_change_event(ScreenRectsChangeEvent&);
+ virtual void applet_area_rect_change_event(AppletAreaRectChangeEvent&);
virtual void enter_event(Core::Event&);
virtual void leave_event(Core::Event&);
@@ -226,6 +227,7 @@ private:
void handle_theme_change_event(ThemeChangeEvent&);
void handle_fonts_change_event(FontsChangeEvent&);
void handle_screen_rects_change_event(ScreenRectsChangeEvent&);
+ void handle_applet_area_rect_change_event(AppletAreaRectChangeEvent&);
void handle_drag_move_event(DragEvent&);
void handle_entered_event(Core::Event&);
void handle_left_event(Core::Event&);
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp
index 7462e0cc8c..a06f9bde20 100644
--- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp
+++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp
@@ -321,6 +321,13 @@ void WindowServerConnection::screen_rects_changed(Vector<Gfx::IntRect> const& re
});
}
+void WindowServerConnection::applet_area_rect_changed(Gfx::IntRect const& rect)
+{
+ Window::for_each_window({}, [&](auto& window) {
+ Core::EventLoop::current().post_event(window, make<AppletAreaRectChangeEvent>(rect));
+ });
+}
+
void WindowServerConnection::set_wallpaper_finished(bool)
{
// This is handled manually by Desktop::set_wallpaper().
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.h b/Userland/Libraries/LibGUI/WindowServerConnection.h
index 91a5bbc195..f9d4b92751 100644
--- a/Userland/Libraries/LibGUI/WindowServerConnection.h
+++ b/Userland/Libraries/LibGUI/WindowServerConnection.h
@@ -46,6 +46,7 @@ private:
virtual void menu_item_left(i32, u32) override;
virtual void menu_visibility_did_change(i32, bool) override;
virtual void screen_rects_changed(Vector<Gfx::IntRect> const&, u32, u32, u32) override;
+ virtual void applet_area_rect_changed(Gfx::IntRect const&) override;
virtual void set_wallpaper_finished(bool) override;
virtual void drag_dropped(i32, Gfx::IntPoint const&, String const&, HashMap<String, ByteBuffer> const&) override;
virtual void drag_accepted() override;
diff --git a/Userland/Services/WindowServer/WMClientConnection.cpp b/Userland/Services/WindowServer/WMClientConnection.cpp
index 9aaba46b64..55ba25189d 100644
--- a/Userland/Services/WindowServer/WMClientConnection.cpp
+++ b/Userland/Services/WindowServer/WMClientConnection.cpp
@@ -42,6 +42,10 @@ void WMClientConnection::set_applet_area_position(Gfx::IntPoint const& position)
}
AppletManager::the().set_position(position);
+
+ WindowServer::ClientConnection::for_each_client([](auto& connection) {
+ connection.post_message(Messages::WindowClient::AppletAreaRectChanged(AppletManager::the().window()->rect()));
+ });
}
void WMClientConnection::set_active_window(i32 client_id, i32 window_id)
diff --git a/Userland/Services/WindowServer/WindowClient.ipc b/Userland/Services/WindowServer/WindowClient.ipc
index 61b9911316..2b8b3c839f 100644
--- a/Userland/Services/WindowServer/WindowClient.ipc
+++ b/Userland/Services/WindowServer/WindowClient.ipc
@@ -30,6 +30,8 @@ endpoint WindowClient
screen_rects_changed(Vector<Gfx::IntRect> rects, u32 main_screen_index, u32 virtual_desktop_rows, u32 virtual_desktop_columns) =|
+ applet_area_rect_changed(Gfx::IntRect rect) =|
+
set_wallpaper_finished(bool success) =|
drag_accepted() =|