summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp110
-rw-r--r--Servers/WindowServer/WSClientConnection.h56
-rw-r--r--Servers/WindowServer/WSClipboard.cpp2
-rw-r--r--Servers/WindowServer/WSClipboard.h2
-rw-r--r--Servers/WindowServer/WSMenu.cpp4
-rw-r--r--Servers/WindowServer/WSMenu.h2
-rw-r--r--Servers/WindowServer/WSMessageReceiver.h2
-rw-r--r--Servers/WindowServer/WSWindow.cpp18
-rw-r--r--Servers/WindowServer/WSWindow.h2
-rw-r--r--Servers/WindowServer/WSWindowManager.cpp24
-rw-r--r--Servers/WindowServer/WSWindowManager.h22
-rw-r--r--Servers/WindowServer/WSWindowSwitcher.cpp2
-rw-r--r--Servers/WindowServer/WSWindowSwitcher.h2
13 files changed, 124 insertions, 124 deletions
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index 3ca579d96f..3aa1dc95d2 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -83,22 +83,22 @@ void WSClientConnection::post_message(const WSAPI_ServerMessage& message)
ASSERT(nwritten == sizeof(message));
}
-void WSClientConnection::on_message(WSMessage& message)
+void WSClientConnection::on_message(const WSMessage& message)
{
if (message.is_client_request()) {
- on_request(static_cast<WSAPIClientRequest&>(message));
+ on_request(static_cast<const WSAPIClientRequest&>(message));
return;
}
if (message.type() == WSMessage::WM_ClientDisconnected) {
- int client_id = static_cast<WSClientDisconnectedNotification&>(message).client_id();
+ int client_id = static_cast<const WSClientDisconnectedNotification&>(message).client_id();
dbgprintf("WSClientConnection: Client disconnected: %d\n", client_id);
delete this;
return;
}
}
-void WSClientConnection::handle_request(WSAPICreateMenubarRequest&)
+void WSClientConnection::handle_request(const WSAPICreateMenubarRequest&)
{
int menubar_id = m_next_menubar_id++;
auto menubar = make<WSMenuBar>(*this, menubar_id);
@@ -109,7 +109,7 @@ void WSClientConnection::handle_request(WSAPICreateMenubarRequest&)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIDestroyMenubarRequest& request)
+void WSClientConnection::handle_request(const WSAPIDestroyMenubarRequest& request)
{
int menubar_id = request.menubar_id();
auto it = m_menubars.find(menubar_id);
@@ -126,7 +126,7 @@ void WSClientConnection::handle_request(WSAPIDestroyMenubarRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPICreateMenuRequest& request)
+void WSClientConnection::handle_request(const WSAPICreateMenuRequest& request)
{
int menu_id = m_next_menu_id++;
auto menu = make<WSMenu>(this, menu_id, request.text());
@@ -137,9 +137,9 @@ void WSClientConnection::handle_request(WSAPICreateMenuRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIDestroyMenuRequest& request)
+void WSClientConnection::handle_request(const WSAPIDestroyMenuRequest& request)
{
- int menu_id = static_cast<WSAPIDestroyMenuRequest&>(request).menu_id();
+ int menu_id = static_cast<const WSAPIDestroyMenuRequest&>(request).menu_id();
auto it = m_menus.find(menu_id);
if (it == m_menus.end()) {
post_error("Bad menu ID");
@@ -154,7 +154,7 @@ void WSClientConnection::handle_request(WSAPIDestroyMenuRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetApplicationMenubarRequest& request)
+void WSClientConnection::handle_request(const WSAPISetApplicationMenubarRequest& request)
{
int menubar_id = request.menubar_id();
auto it = m_menubars.find(menubar_id);
@@ -171,7 +171,7 @@ void WSClientConnection::handle_request(WSAPISetApplicationMenubarRequest& reque
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIAddMenuToMenubarRequest& request)
+void WSClientConnection::handle_request(const WSAPIAddMenuToMenubarRequest& request)
{
int menubar_id = request.menubar_id();
int menu_id = request.menu_id();
@@ -195,7 +195,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuToMenubarRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request)
+void WSClientConnection::handle_request(const WSAPIAddMenuItemRequest& request)
{
int menu_id = request.menu_id();
unsigned identifier = request.identifier();
@@ -213,7 +213,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIAddMenuSeparatorRequest& request)
+void WSClientConnection::handle_request(const WSAPIAddMenuSeparatorRequest& request)
{
int menu_id = request.menu_id();
auto it = m_menus.find(menu_id);
@@ -229,7 +229,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuSeparatorRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetWindowOpacityRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWindowOpacityRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -241,7 +241,7 @@ void WSClientConnection::handle_request(WSAPISetWindowOpacityRequest& request)
window.set_opacity(request.opacity());
}
-void WSClientConnection::handle_request(WSAPISetWallpaperRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWallpaperRequest& request)
{
bool success = WSWindowManager::the().set_wallpaper(request.wallpaper());
WSAPI_ServerMessage response;
@@ -250,7 +250,7 @@ void WSClientConnection::handle_request(WSAPISetWallpaperRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIGetWallpaperRequest& request)
+void WSClientConnection::handle_request(const WSAPIGetWallpaperRequest&)
{
auto path = WSWindowManager::the().wallpaper_path();
WSAPI_ServerMessage response;
@@ -261,7 +261,7 @@ void WSClientConnection::handle_request(WSAPIGetWallpaperRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetWindowTitleRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWindowTitleRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -273,7 +273,7 @@ void WSClientConnection::handle_request(WSAPISetWindowTitleRequest& request)
window.set_title(request.title());
}
-void WSClientConnection::handle_request(WSAPIGetWindowTitleRequest& request)
+void WSClientConnection::handle_request(const WSAPIGetWindowTitleRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -291,7 +291,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowTitleRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetWindowRectRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWindowRectRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -303,7 +303,7 @@ void WSClientConnection::handle_request(WSAPISetWindowRectRequest& request)
window.set_rect(request.rect());
}
-void WSClientConnection::handle_request(WSAPIGetWindowRectRequest& request)
+void WSClientConnection::handle_request(const WSAPIGetWindowRectRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -319,7 +319,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowRectRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetClipboardContentsRequest& request)
+void WSClientConnection::handle_request(const WSAPISetClipboardContentsRequest& request)
{
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(request.shared_buffer_id());
if (!shared_buffer) {
@@ -333,7 +333,7 @@ void WSClientConnection::handle_request(WSAPISetClipboardContentsRequest& reques
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIGetClipboardContentsRequest&)
+void WSClientConnection::handle_request(const WSAPIGetClipboardContentsRequest&)
{
WSAPI_ServerMessage response;
response.type = WSAPI_ServerMessage::Type::DidGetClipboardContents;
@@ -357,7 +357,7 @@ void WSClientConnection::handle_request(WSAPIGetClipboardContentsRequest&)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPICreateWindowRequest& request)
+void WSClientConnection::handle_request(const WSAPICreateWindowRequest& request)
{
int window_id = m_next_window_id++;
auto window = make<WSWindow>(*this, window_id, request.is_modal());
@@ -376,7 +376,7 @@ void WSClientConnection::handle_request(WSAPICreateWindowRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIDestroyWindowRequest& request)
+void WSClientConnection::handle_request(const WSAPIDestroyWindowRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -389,7 +389,7 @@ void WSClientConnection::handle_request(WSAPIDestroyWindowRequest& request)
m_windows.remove(it);
}
-void WSClientConnection::handle_request(WSAPIInvalidateRectRequest& request)
+void WSClientConnection::handle_request(const WSAPIInvalidateRectRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -406,7 +406,7 @@ void WSClientConnection::handle_request(WSAPIInvalidateRectRequest& request)
post_message(response);
}
-void WSClientConnection::handle_request(WSAPIDidFinishPaintingNotification& request)
+void WSClientConnection::handle_request(const WSAPIDidFinishPaintingNotification& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -425,7 +425,7 @@ void WSClientConnection::handle_request(WSAPIDidFinishPaintingNotification& requ
WSWindowManager::the().invalidate(window, request.rect());
}
-void WSClientConnection::handle_request(WSAPIGetWindowBackingStoreRequest& request)
+void WSClientConnection::handle_request(const WSAPIGetWindowBackingStoreRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -447,7 +447,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowBackingStoreRequest& reque
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetWindowBackingStoreRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWindowBackingStoreRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -479,7 +479,7 @@ void WSClientConnection::handle_request(WSAPISetWindowBackingStoreRequest& reque
post_message(response);
}
-void WSClientConnection::handle_request(WSAPISetGlobalCursorTrackingRequest& request)
+void WSClientConnection::handle_request(const WSAPISetGlobalCursorTrackingRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -491,7 +491,7 @@ void WSClientConnection::handle_request(WSAPISetGlobalCursorTrackingRequest& req
window.set_global_cursor_tracking_enabled(request.value());
}
-void WSClientConnection::handle_request(WSAPISetWindowOverrideCursorRequest& request)
+void WSClientConnection::handle_request(const WSAPISetWindowOverrideCursorRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
@@ -503,59 +503,59 @@ void WSClientConnection::handle_request(WSAPISetWindowOverrideCursorRequest& req
window.set_override_cursor(WSCursor::create(request.cursor()));
}
-void WSClientConnection::on_request(WSAPIClientRequest& request)
+void WSClientConnection::on_request(const WSAPIClientRequest& request)
{
switch (request.type()) {
case WSMessage::APICreateMenubarRequest:
- return handle_request(static_cast<WSAPICreateMenubarRequest&>(request));
+ return handle_request(static_cast<const WSAPICreateMenubarRequest&>(request));
case WSMessage::APIDestroyMenubarRequest:
- return handle_request(static_cast<WSAPIDestroyMenubarRequest&>(request));
+ return handle_request(static_cast<const WSAPIDestroyMenubarRequest&>(request));
case WSMessage::APICreateMenuRequest:
- return handle_request(static_cast<WSAPICreateMenuRequest&>(request));
+ return handle_request(static_cast<const WSAPICreateMenuRequest&>(request));
case WSMessage::APIDestroyMenuRequest:
- return handle_request(static_cast<WSAPIDestroyMenuRequest&>(request));
+ return handle_request(static_cast<const WSAPIDestroyMenuRequest&>(request));
case WSMessage::APISetApplicationMenubarRequest:
- return handle_request(static_cast<WSAPISetApplicationMenubarRequest&>(request));
+ return handle_request(static_cast<const WSAPISetApplicationMenubarRequest&>(request));
case WSMessage::APIAddMenuToMenubarRequest:
- return handle_request(static_cast<WSAPIAddMenuToMenubarRequest&>(request));
+ return handle_request(static_cast<const WSAPIAddMenuToMenubarRequest&>(request));
case WSMessage::APIAddMenuItemRequest:
- return handle_request(static_cast<WSAPIAddMenuItemRequest&>(request));
+ return handle_request(static_cast<const WSAPIAddMenuItemRequest&>(request));
case WSMessage::APIAddMenuSeparatorRequest:
- return handle_request(static_cast<WSAPIAddMenuSeparatorRequest&>(request));
+ return handle_request(static_cast<const WSAPIAddMenuSeparatorRequest&>(request));
case WSMessage::APISetWindowTitleRequest:
- return handle_request(static_cast<WSAPISetWindowTitleRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWindowTitleRequest&>(request));
case WSMessage::APIGetWindowTitleRequest:
- return handle_request(static_cast<WSAPIGetWindowTitleRequest&>(request));
+ return handle_request(static_cast<const WSAPIGetWindowTitleRequest&>(request));
case WSMessage::APISetWindowRectRequest:
- return handle_request(static_cast<WSAPISetWindowRectRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWindowRectRequest&>(request));
case WSMessage::APIGetWindowRectRequest:
- return handle_request(static_cast<WSAPIGetWindowRectRequest&>(request));
+ return handle_request(static_cast<const WSAPIGetWindowRectRequest&>(request));
case WSMessage::APISetClipboardContentsRequest:
- return handle_request(static_cast<WSAPISetClipboardContentsRequest&>(request));
+ return handle_request(static_cast<const WSAPISetClipboardContentsRequest&>(request));
case WSMessage::APIGetClipboardContentsRequest:
- return handle_request(static_cast<WSAPIGetClipboardContentsRequest&>(request));
+ return handle_request(static_cast<const WSAPIGetClipboardContentsRequest&>(request));
case WSMessage::APICreateWindowRequest:
- return handle_request(static_cast<WSAPICreateWindowRequest&>(request));
+ return handle_request(static_cast<const WSAPICreateWindowRequest&>(request));
case WSMessage::APIDestroyWindowRequest:
- return handle_request(static_cast<WSAPIDestroyWindowRequest&>(request));
+ return handle_request(static_cast<const WSAPIDestroyWindowRequest&>(request));
case WSMessage::APIInvalidateRectRequest:
- return handle_request(static_cast<WSAPIInvalidateRectRequest&>(request));
+ return handle_request(static_cast<const WSAPIInvalidateRectRequest&>(request));
case WSMessage::APIDidFinishPaintingNotification:
- return handle_request(static_cast<WSAPIDidFinishPaintingNotification&>(request));
+ return handle_request(static_cast<const WSAPIDidFinishPaintingNotification&>(request));
case WSMessage::APIGetWindowBackingStoreRequest:
- return handle_request(static_cast<WSAPIGetWindowBackingStoreRequest&>(request));
+ return handle_request(static_cast<const WSAPIGetWindowBackingStoreRequest&>(request));
case WSMessage::APISetGlobalCursorTrackingRequest:
- return handle_request(static_cast<WSAPISetGlobalCursorTrackingRequest&>(request));
+ return handle_request(static_cast<const WSAPISetGlobalCursorTrackingRequest&>(request));
case WSMessage::APISetWindowOpacityRequest:
- return handle_request(static_cast<WSAPISetWindowOpacityRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWindowOpacityRequest&>(request));
case WSMessage::APISetWindowBackingStoreRequest:
- return handle_request(static_cast<WSAPISetWindowBackingStoreRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWindowBackingStoreRequest&>(request));
case WSMessage::APISetWallpaperRequest:
- return handle_request(static_cast<WSAPISetWallpaperRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWallpaperRequest&>(request));
case WSMessage::APIGetWallpaperRequest:
- return handle_request(static_cast<WSAPIGetWallpaperRequest&>(request));
+ return handle_request(static_cast<const WSAPIGetWallpaperRequest&>(request));
case WSMessage::APISetWindowOverrideCursorRequest:
- return handle_request(static_cast<WSAPISetWindowOverrideCursorRequest&>(request));
+ return handle_request(static_cast<const WSAPISetWindowOverrideCursorRequest&>(request));
default:
break;
}
diff --git a/Servers/WindowServer/WSClientConnection.h b/Servers/WindowServer/WSClientConnection.h
index f596ac59e1..e636efe5b2 100644
--- a/Servers/WindowServer/WSClientConnection.h
+++ b/Servers/WindowServer/WSClientConnection.h
@@ -37,34 +37,34 @@ public:
template<typename Callback> void for_each_window(Callback);
private:
- virtual void on_message(WSMessage&) override;
-
- void on_request(WSAPIClientRequest&);
- void handle_request(WSAPICreateMenubarRequest&);
- void handle_request(WSAPIDestroyMenubarRequest&);
- void handle_request(WSAPICreateMenuRequest&);
- void handle_request(WSAPIDestroyMenuRequest&);
- void handle_request(WSAPISetApplicationMenubarRequest&);
- void handle_request(WSAPIAddMenuToMenubarRequest&);
- void handle_request(WSAPIAddMenuItemRequest&);
- void handle_request(WSAPIAddMenuSeparatorRequest&);
- void handle_request(WSAPISetWindowTitleRequest&);
- void handle_request(WSAPIGetWindowTitleRequest&);
- void handle_request(WSAPISetWindowRectRequest&);
- void handle_request(WSAPIGetWindowRectRequest&);
- void handle_request(WSAPISetClipboardContentsRequest&);
- void handle_request(WSAPIGetClipboardContentsRequest&);
- void handle_request(WSAPICreateWindowRequest&);
- void handle_request(WSAPIDestroyWindowRequest&);
- void handle_request(WSAPIInvalidateRectRequest&);
- void handle_request(WSAPIDidFinishPaintingNotification&);
- void handle_request(WSAPIGetWindowBackingStoreRequest&);
- void handle_request(WSAPISetWindowBackingStoreRequest&);
- void handle_request(WSAPISetGlobalCursorTrackingRequest&);
- void handle_request(WSAPISetWindowOpacityRequest&);
- void handle_request(WSAPISetWallpaperRequest&);
- void handle_request(WSAPIGetWallpaperRequest&);
- void handle_request(WSAPISetWindowOverrideCursorRequest&);
+ virtual void on_message(const WSMessage&) override;
+
+ void on_request(const WSAPIClientRequest&);
+ void handle_request(const WSAPICreateMenubarRequest&);
+ void handle_request(const WSAPIDestroyMenubarRequest&);
+ void handle_request(const WSAPICreateMenuRequest&);
+ void handle_request(const WSAPIDestroyMenuRequest&);
+ void handle_request(const WSAPISetApplicationMenubarRequest&);
+ void handle_request(const WSAPIAddMenuToMenubarRequest&);
+ void handle_request(const WSAPIAddMenuItemRequest&);
+ void handle_request(const WSAPIAddMenuSeparatorRequest&);
+ void handle_request(const WSAPISetWindowTitleRequest&);
+ void handle_request(const WSAPIGetWindowTitleRequest&);
+ void handle_request(const WSAPISetWindowRectRequest&);
+ void handle_request(const WSAPIGetWindowRectRequest&);
+ void handle_request(const WSAPISetClipboardContentsRequest&);
+ void handle_request(const WSAPIGetClipboardContentsRequest&);
+ void handle_request(const WSAPICreateWindowRequest&);
+ void handle_request(const WSAPIDestroyWindowRequest&);
+ void handle_request(const WSAPIInvalidateRectRequest&);
+ void handle_request(const WSAPIDidFinishPaintingNotification&);
+ void handle_request(const WSAPIGetWindowBackingStoreRequest&);
+ void handle_request(const WSAPISetWindowBackingStoreRequest&);
+ void handle_request(const WSAPISetGlobalCursorTrackingRequest&);
+ void handle_request(const WSAPISetWindowOpacityRequest&);
+ void handle_request(const WSAPISetWallpaperRequest&);
+ void handle_request(const WSAPIGetWallpaperRequest&);
+ void handle_request(const WSAPISetWindowOverrideCursorRequest&);
void post_error(const String&);
diff --git a/Servers/WindowServer/WSClipboard.cpp b/Servers/WindowServer/WSClipboard.cpp
index 1a7f8f2ea1..7e54b168c8 100644
--- a/Servers/WindowServer/WSClipboard.cpp
+++ b/Servers/WindowServer/WSClipboard.cpp
@@ -16,7 +16,7 @@ WSClipboard::~WSClipboard()
{
}
-void WSClipboard::on_message(WSMessage&)
+void WSClipboard::on_message(const WSMessage&)
{
}
diff --git a/Servers/WindowServer/WSClipboard.h b/Servers/WindowServer/WSClipboard.h
index 6c29bb8cd8..2d22beb6f3 100644
--- a/Servers/WindowServer/WSClipboard.h
+++ b/Servers/WindowServer/WSClipboard.h
@@ -22,7 +22,7 @@ public:
private:
WSClipboard();
- virtual void on_message(WSMessage&) override;
+ virtual void on_message(const WSMessage&) override;
RetainPtr<SharedBuffer> m_shared_buffer;
int m_contents_size { 0 };
diff --git a/Servers/WindowServer/WSMenu.cpp b/Servers/WindowServer/WSMenu.cpp
index b8b457122f..02eeaa7723 100644
--- a/Servers/WindowServer/WSMenu.cpp
+++ b/Servers/WindowServer/WSMenu.cpp
@@ -107,11 +107,11 @@ void WSMenu::draw()
}
}
-void WSMenu::on_message(WSMessage& message)
+void WSMenu::on_message(const WSMessage& message)
{
ASSERT(menu_window());
if (message.type() == WSMessage::MouseMove) {
- auto* item = item_at(static_cast<WSMouseEvent&>(message).position());
+ auto* item = item_at(static_cast<const WSMouseEvent&>(message).position());
if (!item || m_hovered_item == item)
return;
m_hovered_item = item;
diff --git a/Servers/WindowServer/WSMenu.h b/Servers/WindowServer/WSMenu.h
index e7e6c34ef0..03315358a8 100644
--- a/Servers/WindowServer/WSMenu.h
+++ b/Servers/WindowServer/WSMenu.h
@@ -73,7 +73,7 @@ public:
void close();
private:
- virtual void on_message(WSMessage&) override;
+ virtual void on_message(const WSMessage&) override;
int padding_between_text_and_shortcut() const { return 50; }
void did_activate(WSMenuItem&);
diff --git a/Servers/WindowServer/WSMessageReceiver.h b/Servers/WindowServer/WSMessageReceiver.h
index 97ee114c8c..eaf8933846 100644
--- a/Servers/WindowServer/WSMessageReceiver.h
+++ b/Servers/WindowServer/WSMessageReceiver.h
@@ -9,5 +9,5 @@ public:
WSMessageReceiver();
virtual ~WSMessageReceiver();
- virtual void on_message(WSMessage&) = 0;
+ virtual void on_message(const WSMessage&) = 0;
};
diff --git a/Servers/WindowServer/WSWindow.cpp b/Servers/WindowServer/WSWindow.cpp
index bde22c0109..c63f3cce3b 100644
--- a/Servers/WindowServer/WSWindow.cpp
+++ b/Servers/WindowServer/WSWindow.cpp
@@ -91,7 +91,7 @@ void WSWindow::handle_mouse_event(const WSMouseEvent& event)
m_client->post_message(server_message);
}
-void WSWindow::on_message(WSMessage& message)
+void WSWindow::on_message(const WSMessage& message)
{
if (m_internal_owner)
return m_internal_owner->on_message(message);
@@ -114,15 +114,15 @@ void WSWindow::on_message(WSMessage& message)
break;
case WSMessage::KeyDown:
server_message.type = WSAPI_ServerMessage::Type::KeyDown;
- server_message.key.character = static_cast<WSKeyEvent&>(message).character();
- server_message.key.key = static_cast<WSKeyEvent&>(message).key();
- server_message.key.modifiers = static_cast<WSKeyEvent&>(message).modifiers();
+ server_message.key.character = static_cast<const WSKeyEvent&>(message).character();
+ server_message.key.key = static_cast<const WSKeyEvent&>(message).key();
+ server_message.key.modifiers = static_cast<const WSKeyEvent&>(message).modifiers();
break;
case WSMessage::KeyUp:
server_message.type = WSAPI_ServerMessage::Type::KeyUp;
- server_message.key.character = static_cast<WSKeyEvent&>(message).character();
- server_message.key.key = static_cast<WSKeyEvent&>(message).key();
- server_message.key.modifiers = static_cast<WSKeyEvent&>(message).modifiers();
+ server_message.key.character = static_cast<const WSKeyEvent&>(message).character();
+ server_message.key.key = static_cast<const WSKeyEvent&>(message).key();
+ server_message.key.modifiers = static_cast<const WSKeyEvent&>(message).modifiers();
break;
case WSMessage::WindowActivated:
server_message.type = WSAPI_ServerMessage::Type::WindowActivated;
@@ -135,8 +135,8 @@ void WSWindow::on_message(WSMessage& message)
break;
case WSMessage::WindowResized:
server_message.type = WSAPI_ServerMessage::Type::WindowResized;
- server_message.window.old_rect = static_cast<WSResizeEvent&>(message).old_rect();
- server_message.window.rect = static_cast<WSResizeEvent&>(message).rect();
+ server_message.window.old_rect = static_cast<const WSResizeEvent&>(message).old_rect();
+ server_message.window.rect = static_cast<const WSResizeEvent&>(message).rect();
break;
default:
break;
diff --git a/Servers/WindowServer/WSWindow.h b/Servers/WindowServer/WSWindow.h
index 624b951d57..c080951c15 100644
--- a/Servers/WindowServer/WSWindow.h
+++ b/Servers/WindowServer/WSWindow.h
@@ -64,7 +64,7 @@ public:
void invalidate();
- virtual void on_message(WSMessage&) override;
+ virtual void on_message(const WSMessage&) override;
GraphicsBitmap* backing_store() { return m_backing_store.ptr(); }
void set_backing_store(RetainPtr<GraphicsBitmap>&& backing_store)
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp
index 3791f66699..43d828eb3e 100644
--- a/Servers/WindowServer/WSWindowManager.cpp
+++ b/Servers/WindowServer/WSWindowManager.cpp
@@ -402,7 +402,7 @@ static CharacterBitmap* s_close_button_bitmap;
static const int s_close_button_bitmap_width = 8;
static const int s_close_button_bitmap_height = 9;
-void WSWindowManager::paint_window_frame(WSWindow& window)
+void WSWindowManager::paint_window_frame(const WSWindow& window)
{
//printf("[WM] paint_window_frame {%p}, rect: %d,%d %dx%d\n", &window, window.rect().x(), window.rect().y(), window.rect().width(), window.rect().height());
@@ -546,7 +546,7 @@ void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect
m_switcher.refresh();
}
-void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, WSMouseEvent& event)
+void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, const WSMouseEvent& event)
{
bool is_hover_with_any_menu_open = event.type() == WSMouseEvent::MouseMove && m_current_menu;
bool is_mousedown_with_left_button = event.type() == WSMouseEvent::MouseDown && event.button() == MouseButton::Left;
@@ -577,7 +577,7 @@ void WSWindowManager::close_current_menu()
m_current_menu = nullptr;
}
-void WSWindowManager::handle_menubar_mouse_event(WSMouseEvent& event)
+void WSWindowManager::handle_menubar_mouse_event(const WSMouseEvent& event)
{
for_each_active_menubar_menu([&] (WSMenu& menu) {
if (menu.rect_in_menubar().contains(event.position())) {
@@ -588,7 +588,7 @@ void WSWindowManager::handle_menubar_mouse_event(WSMouseEvent& event)
});
}
-void WSWindowManager::handle_close_button_mouse_event(WSWindow& window, WSMouseEvent& event)
+void WSWindowManager::handle_close_button_mouse_event(WSWindow& window, const WSMouseEvent& event)
{
if (event.type() == WSMessage::MouseDown && event.button() == MouseButton::Left) {
WSMessage message(WSMessage::WindowCloseRequest);
@@ -597,7 +597,7 @@ void WSWindowManager::handle_close_button_mouse_event(WSWindow& window, WSMouseE
}
}
-void WSWindowManager::start_window_drag(WSWindow& window, WSMouseEvent& event)
+void WSWindowManager::start_window_drag(WSWindow& window, const WSMouseEvent& event)
{
#ifdef DRAG_DEBUG
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
@@ -609,7 +609,7 @@ void WSWindowManager::start_window_drag(WSWindow& window, WSMouseEvent& event)
invalidate(window);
}
-void WSWindowManager::start_window_resize(WSWindow& window, WSMouseEvent& event)
+void WSWindowManager::start_window_resize(WSWindow& window, const WSMouseEvent& event)
{
move_to_front_and_make_active(window);
constexpr ResizeDirection direction_for_hot_area[3][3] = {
@@ -640,7 +640,7 @@ void WSWindowManager::start_window_resize(WSWindow& window, WSMouseEvent& event)
invalidate(window);
}
-bool WSWindowManager::process_ongoing_window_drag(WSMouseEvent& event, WSWindow*&)
+bool WSWindowManager::process_ongoing_window_drag(const WSMouseEvent& event, WSWindow*&)
{
if (!m_drag_window)
return false;
@@ -667,7 +667,7 @@ bool WSWindowManager::process_ongoing_window_drag(WSMouseEvent& event, WSWindow*
return false;
}
-bool WSWindowManager::process_ongoing_window_resize(WSMouseEvent& event, WSWindow*&)
+bool WSWindowManager::process_ongoing_window_resize(const WSMouseEvent& event, WSWindow*&)
{
if (!m_resize_window)
return false;
@@ -768,7 +768,7 @@ bool WSWindowManager::process_ongoing_window_resize(WSMouseEvent& event, WSWindo
return true;
}
-void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_window)
+void WSWindowManager::process_mouse_event(const WSMouseEvent& event, WSWindow*& event_window)
{
event_window = nullptr;
@@ -1051,17 +1051,17 @@ void WSWindowManager::draw_cursor()
m_last_cursor_rect = cursor_rect;
}
-void WSWindowManager::on_message(WSMessage& message)
+void WSWindowManager::on_message(const WSMessage& message)
{
if (message.is_mouse_event()) {
WSWindow* event_window = nullptr;
- process_mouse_event(static_cast<WSMouseEvent&>(message), event_window);
+ process_mouse_event(static_cast<const WSMouseEvent&>(message), event_window);
set_hovered_window(event_window);
return;
}
if (message.is_key_event()) {
- auto& key_event = static_cast<WSKeyEvent&>(message);
+ auto& key_event = static_cast<const WSKeyEvent&>(message);
m_keyboard_modifiers = key_event.modifiers();
if (key_event.type() == WSMessage::KeyDown && key_event.modifiers() == Mod_Logo && key_event.key() == Key_Tab)
diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h
index 84bcb990e6..40bae77754 100644
--- a/Servers/WindowServer/WSWindowManager.h
+++ b/Servers/WindowServer/WSWindowManager.h
@@ -88,15 +88,15 @@ public:
Rect current_cursor_rect() const;
private:
- void process_mouse_event(WSMouseEvent&, WSWindow*& event_window);
- bool process_ongoing_window_resize(WSMouseEvent&, WSWindow*& event_window);
- bool process_ongoing_window_drag(WSMouseEvent&, WSWindow*& event_window);
- void handle_menu_mouse_event(WSMenu&, WSMouseEvent&);
- void handle_menubar_mouse_event(WSMouseEvent&);
- void handle_close_button_mouse_event(WSWindow&, WSMouseEvent&);
- void start_window_resize(WSWindow&, WSMouseEvent&);
- void start_window_drag(WSWindow&, WSMouseEvent&);
- void handle_client_request(WSAPIClientRequest&);
+ void process_mouse_event(const WSMouseEvent&, WSWindow*& event_window);
+ bool process_ongoing_window_resize(const WSMouseEvent&, WSWindow*& event_window);
+ bool process_ongoing_window_drag(const WSMouseEvent&, WSWindow*& event_window);
+ void handle_menu_mouse_event(WSMenu&, const WSMouseEvent&);
+ void handle_menubar_mouse_event(const WSMouseEvent&);
+ void handle_close_button_mouse_event(WSWindow&, const WSMouseEvent&);
+ void start_window_resize(WSWindow&, const WSMouseEvent&);
+ void start_window_drag(WSWindow&, const WSMouseEvent&);
+ void handle_client_request(const WSAPIClientRequest&);
void set_active_window(WSWindow*);
void set_hovered_window(WSWindow*);
template<typename Callback> IterationDecision for_each_visible_window_of_type_from_back_to_front(WSWindowType, Callback);
@@ -105,9 +105,9 @@ private:
template<typename Callback> IterationDecision for_each_visible_window_from_back_to_front(Callback);
template<typename Callback> void for_each_active_menubar_menu(Callback);
void close_current_menu();
- virtual void on_message(WSMessage&) override;
+ virtual void on_message(const WSMessage&) override;
void compose();
- void paint_window_frame(WSWindow&);
+ void paint_window_frame(const WSWindow&);
void flip_buffers();
void tick_clock();
diff --git a/Servers/WindowServer/WSWindowSwitcher.cpp b/Servers/WindowServer/WSWindowSwitcher.cpp
index 3e91f3d45c..fd0765815c 100644
--- a/Servers/WindowServer/WSWindowSwitcher.cpp
+++ b/Servers/WindowServer/WSWindowSwitcher.cpp
@@ -116,6 +116,6 @@ void WSWindowSwitcher::refresh()
draw();
}
-void WSWindowSwitcher::on_message(WSMessage&)
+void WSWindowSwitcher::on_message(const WSMessage&)
{
}
diff --git a/Servers/WindowServer/WSWindowSwitcher.h b/Servers/WindowServer/WSWindowSwitcher.h
index 418cb4481d..8ea6e4d3bb 100644
--- a/Servers/WindowServer/WSWindowSwitcher.h
+++ b/Servers/WindowServer/WSWindowSwitcher.h
@@ -33,7 +33,7 @@ public:
WSWindow* switcher_window() { return m_switcher_window.ptr(); }
private:
- virtual void on_message(WSMessage&) override;
+ virtual void on_message(const WSMessage&) override;
OwnPtr<WSWindow> m_switcher_window;
Rect m_rect;