summaryrefslogtreecommitdiff
path: root/Servers
diff options
context:
space:
mode:
Diffstat (limited to 'Servers')
-rw-r--r--Servers/WindowServer/WSAPITypes.h3
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp2
-rw-r--r--Servers/WindowServer/WSEvent.h20
-rw-r--r--Servers/WindowServer/WSWindow.cpp14
-rw-r--r--Servers/WindowServer/WSWindowManager.cpp11
-rw-r--r--Servers/WindowServer/WSWindowManager.h1
6 files changed, 40 insertions, 11 deletions
diff --git a/Servers/WindowServer/WSAPITypes.h b/Servers/WindowServer/WSAPITypes.h
index c7c7dc6345..c7377d3e00 100644
--- a/Servers/WindowServer/WSAPITypes.h
+++ b/Servers/WindowServer/WSAPITypes.h
@@ -97,6 +97,7 @@ struct WSAPI_ServerMessage {
ScreenRectChanged,
WM_WindowRemoved,
WM_WindowStateChanged,
+ WM_WindowIconChanged,
};
Type type { Invalid };
int window_id { -1 };
@@ -116,8 +117,6 @@ struct WSAPI_ServerMessage {
bool is_active;
bool is_minimized;
WSAPI_WindowType window_type;
- int icon_path_length;
- char icon_path[256];
} wm;
struct {
WSAPI_Rect rect;
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index e2bf5d3816..c081765fde 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -370,7 +370,7 @@ void WSClientConnection::handle_request(const WSAPISetWindowIconRequest& request
}
window.frame().invalidate_title_bar();
- WSWindowManager::the().tell_wm_listeners_window_state_changed(window);
+ WSWindowManager::the().tell_wm_listeners_window_icon_changed(window);
}
void WSClientConnection::handle_request(const WSAPISetWindowRectRequest& request)
diff --git a/Servers/WindowServer/WSEvent.h b/Servers/WindowServer/WSEvent.h
index 3d635bdadc..4c9d85f5bf 100644
--- a/Servers/WindowServer/WSEvent.h
+++ b/Servers/WindowServer/WSEvent.h
@@ -29,6 +29,7 @@ public:
WM_WindowRemoved,
WM_WindowStateChanged,
+ WM_WindowIconChanged,
__Begin_API_Client_Requests,
APICreateMenubarRequest,
@@ -712,10 +713,9 @@ public:
class WSWMWindowStateChangedEvent : public WSWMEvent {
public:
- WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type, bool is_minimized, const String& icon_path)
+ WSWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect, bool is_active, WSWindowType window_type, bool is_minimized)
: WSWMEvent(WSEvent::WM_WindowStateChanged, client_id, window_id)
, m_title(title)
- , m_icon_path(icon_path)
, m_rect(rect)
, m_active(is_active)
, m_window_type(window_type)
@@ -724,7 +724,6 @@ public:
}
String title() const { return m_title; }
- String icon_path() const { return m_icon_path; }
Rect rect() const { return m_rect; }
bool is_active() const { return m_active; }
WSWindowType window_type() const { return m_window_type; }
@@ -732,9 +731,22 @@ public:
private:
String m_title;
- String m_icon_path;
Rect m_rect;
bool m_active;
WSWindowType m_window_type;
bool m_minimized;
};
+
+class WSWMWindowIconChangedEvent : public WSWMEvent {
+public:
+ WSWMWindowIconChangedEvent(int client_id, int window_id, const String& icon_path)
+ : WSWMEvent(WSEvent::WM_WindowIconChanged, client_id, window_id)
+ , m_icon_path(icon_path)
+ {
+ }
+
+ String icon_path() const { return m_icon_path; }
+
+private:
+ String m_icon_path;
+};
diff --git a/Servers/WindowServer/WSWindow.cpp b/Servers/WindowServer/WSWindow.cpp
index b608b64d00..b8f3df4ca8 100644
--- a/Servers/WindowServer/WSWindow.cpp
+++ b/Servers/WindowServer/WSWindow.cpp
@@ -196,9 +196,17 @@ void WSWindow::event(CEvent& event)
memcpy(server_message.text, changed_event.title().characters(), changed_event.title().length());
server_message.text_length = changed_event.title().length();
server_message.wm.rect = changed_event.rect();
- ASSERT(changed_event.icon_path().length() < sizeof(server_message.wm.icon_path));
- memcpy(server_message.wm.icon_path, changed_event.icon_path().characters(), changed_event.icon_path().length());
- server_message.wm.icon_path_length = changed_event.icon_path().length();
+ break;
+ }
+
+ case WSEvent::WM_WindowIconChanged: {
+ auto& changed_event = static_cast<const WSWMWindowIconChangedEvent&>(event);
+ server_message.type = WSAPI_ServerMessage::Type::WM_WindowIconChanged;
+ server_message.wm.client_id = changed_event.client_id();
+ server_message.wm.window_id = changed_event.window_id();
+ ASSERT(changed_event.icon_path().length() < sizeof(server_message.text));
+ memcpy(server_message.text, changed_event.icon_path().characters(), changed_event.icon_path().length());
+ server_message.text_length = changed_event.icon_path().length();
break;
}
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp
index 8824d3c295..83dda7889e 100644
--- a/Servers/WindowServer/WSWindowManager.cpp
+++ b/Servers/WindowServer/WSWindowManager.cpp
@@ -318,7 +318,7 @@ void WSWindowManager::remove_window(WSWindow& window)
void WSWindowManager::tell_wm_listener_about_window(WSWindow& listener, WSWindow& window)
{
if (window.client())
- WSEventLoop::the().post_event(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type(), window.is_minimized(), window.icon_path()));
+ WSEventLoop::the().post_event(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type(), window.is_minimized()));
}
void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
@@ -329,6 +329,15 @@ void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
});
}
+void WSWindowManager::tell_wm_listeners_window_icon_changed(WSWindow& window)
+{
+ for_each_window_listening_to_wm_events([&] (WSWindow& listener) {
+ if (window.client())
+ WSEventLoop::the().post_event(listener, make<WSWMWindowIconChangedEvent>(window.client()->client_id(), window.window_id(), window.icon_path()));
+ return IterationDecision::Continue;
+ });
+}
+
void WSWindowManager::notify_title_changed(WSWindow& window)
{
dbgprintf("[WM] WSWindow{%p} title set to '%s'\n", &window, window.title().characters());
diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h
index c2d875637b..27c044abf6 100644
--- a/Servers/WindowServer/WSWindowManager.h
+++ b/Servers/WindowServer/WSWindowManager.h
@@ -111,6 +111,7 @@ public:
bool any_opaque_window_above_this_one_contains_rect(const WSWindow&, const Rect&);
void tell_wm_listeners_window_state_changed(WSWindow&);
+ void tell_wm_listeners_window_icon_changed(WSWindow&);
private:
void process_mouse_event(const WSMouseEvent&, WSWindow*& event_window);