summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WindowServer/WSClientConnection.cpp531
-rw-r--r--WindowServer/WSClientConnection.h23
-rw-r--r--WindowServer/WSMessage.h5
-rw-r--r--WindowServer/WSMessageLoop.cpp2
4 files changed, 325 insertions, 236 deletions
diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp
index ff780e73e3..e674b5ede5 100644
--- a/WindowServer/WSClientConnection.cpp
+++ b/WindowServer/WSClientConnection.cpp
@@ -49,7 +49,7 @@ WSClientConnection::~WSClientConnection()
void WSClientConnection::on_message(WSMessage& message)
{
if (message.is_client_request()) {
- handle_client_request(static_cast<WSAPIClientRequest&>(message));
+ on_request(static_cast<WSAPIClientRequest&>(message));
return;
}
@@ -61,255 +61,322 @@ void WSClientConnection::on_message(WSMessage& message)
}
}
-void WSClientConnection::handle_client_request(WSAPIClientRequest& request)
+void WSClientConnection::handle_request(WSAPICreateMenubarRequest& request)
{
- switch (request.type()) {
- case WSMessage::APICreateMenubarRequest: {
- int menubar_id = m_next_menubar_id++;
- auto menubar = make<WSMenuBar>(menubar_id, *WSMessageLoop::process_from_client_id(request.client_id()));
- m_menubars.set(menubar_id, move(menubar));
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidCreateMenubar;
- response.menu.menubar_id = menubar_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
- }
- case WSMessage::APIDestroyMenubarRequest: {
- int menubar_id = static_cast<WSAPIDestroyMenubarRequest&>(request).menubar_id();
- auto it = m_menubars.find(menubar_id);
- if (it == m_menubars.end()) {
- ASSERT_NOT_REACHED();
- // FIXME: Send an error.
- return;
- }
- auto& menubar = *(*it).value;
- WSWindowManager::the().close_menubar(menubar);
- m_menubars.remove(it);
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidDestroyMenubar;
- response.menu.menubar_id = menubar_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
- }
- case WSMessage::APICreateMenuRequest: {
- int menu_id = m_next_menu_id++;
- auto menu = make<WSMenu>(*WSMessageLoop::process_from_client_id(request.client_id()), menu_id, static_cast<WSAPICreateMenuRequest&>(request).text());
- m_menus.set(menu_id, move(menu));
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidCreateMenu;
- response.menu.menu_id = menu_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ int menubar_id = m_next_menubar_id++;
+ auto menubar = make<WSMenuBar>(menubar_id, *WSMessageLoop::process_from_client_id(request.client_id()));
+ m_menubars.set(menubar_id, move(menubar));
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidCreateMenubar;
+ response.menu.menubar_id = menubar_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIDestroyMenubarRequest& request)
+{
+ int menubar_id = request.menubar_id();
+ auto it = m_menubars.find(menubar_id);
+ if (it == m_menubars.end()) {
+ ASSERT_NOT_REACHED();
+ // FIXME: Send an error.
+ return;
}
- case WSMessage::APIDestroyMenuRequest: {
- int menu_id = static_cast<WSAPIDestroyMenuRequest&>(request).menu_id();
- auto it = m_menus.find(menu_id);
- if (it == m_menus.end()) {
- ASSERT_NOT_REACHED();
- // FIXME: Send an error.
- return;
- }
- auto& menu = *(*it).value;
- WSWindowManager::the().close_menu(menu);
- m_menus.remove(it);
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidDestroyMenu;
- response.menu.menu_id = menu_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& menubar = *(*it).value;
+ WSWindowManager::the().close_menubar(menubar);
+ m_menubars.remove(it);
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidDestroyMenubar;
+ response.menu.menubar_id = menubar_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPICreateMenuRequest& request)
+{
+ int menu_id = m_next_menu_id++;
+ auto menu = make<WSMenu>(*WSMessageLoop::process_from_client_id(request.client_id()), menu_id, request.text());
+ m_menus.set(menu_id, move(menu));
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidCreateMenu;
+ response.menu.menu_id = menu_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIDestroyMenuRequest& request)
+{
+ int menu_id = static_cast<WSAPIDestroyMenuRequest&>(request).menu_id();
+ auto it = m_menus.find(menu_id);
+ if (it == m_menus.end()) {
+ ASSERT_NOT_REACHED();
+ // FIXME: Send an error.
+ return;
}
- case WSMessage::APISetApplicationMenubarRequest: {
- int menubar_id = static_cast<WSAPISetApplicationMenubarRequest&>(request).menubar_id();
- auto it = m_menubars.find(menubar_id);
- if (it == m_menubars.end()) {
- ASSERT_NOT_REACHED();
- // FIXME: Send an error.
- return;
- }
- auto& menubar = *(*it).value;
- m_app_menubar = menubar.make_weak_ptr();
- WSWindowManager::the().notify_client_changed_app_menubar(*this);
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidSetApplicationMenubar;
- response.menu.menubar_id = menubar_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& menu = *(*it).value;
+ WSWindowManager::the().close_menu(menu);
+ m_menus.remove(it);
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidDestroyMenu;
+ response.menu.menu_id = menu_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPISetApplicationMenubarRequest& request)
+{
+ int menubar_id = request.menubar_id();
+ auto it = m_menubars.find(menubar_id);
+ if (it == m_menubars.end()) {
+ ASSERT_NOT_REACHED();
+ // FIXME: Send an error.
+ return;
}
- case WSMessage::APIAddMenuToMenubarRequest: {
- int menubar_id = static_cast<WSAPIAddMenuToMenubarRequest&>(request).menubar_id();
- int menu_id = static_cast<WSAPIAddMenuToMenubarRequest&>(request).menu_id();
- auto it = m_menubars.find(menubar_id);
- auto jt = m_menus.find(menu_id);
- if (it == m_menubars.end() || jt == m_menus.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& menubar = *(*it).value;
- auto& menu = *(*jt).value;
- menubar.add_menu(&menu);
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidAddMenuToMenubar;
- response.menu.menubar_id = menubar_id;
- response.menu.menu_id = menu_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& menubar = *(*it).value;
+ m_app_menubar = menubar.make_weak_ptr();
+ WSWindowManager::the().notify_client_changed_app_menubar(*this);
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidSetApplicationMenubar;
+ response.menu.menubar_id = menubar_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIAddMenuToMenubarRequest& request)
+{
+ int menubar_id = request.menubar_id();
+ int menu_id = request.menu_id();
+ auto it = m_menubars.find(menubar_id);
+ auto jt = m_menus.find(menu_id);
+ if (it == m_menubars.end() || jt == m_menus.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIAddMenuItemRequest: {
- int menu_id = static_cast<WSAPIAddMenuItemRequest&>(request).menu_id();
- unsigned identifier = static_cast<WSAPIAddMenuItemRequest&>(request).identifier();
- String text = static_cast<WSAPIAddMenuItemRequest&>(request).text();
- auto it = m_menus.find(menu_id);
- if (it == m_menus.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& menu = *(*it).value;
- menu.add_item(make<WSMenuItem>(identifier, move(text)));
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidAddMenuItem;
- response.menu.menu_id = menu_id;
- response.menu.identifier = identifier;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& menubar = *(*it).value;
+ auto& menu = *(*jt).value;
+ menubar.add_menu(&menu);
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidAddMenuToMenubar;
+ response.menu.menubar_id = menubar_id;
+ response.menu.menu_id = menu_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request)
+{
+ int menu_id = request.menu_id();
+ unsigned identifier = request.identifier();
+ String text = request.text();
+ auto it = m_menus.find(menu_id);
+ if (it == m_menus.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIAddMenuSeparatorRequest: {
- int menu_id = static_cast<WSAPIAddMenuSeparatorRequest&>(request).menu_id();
- auto it = m_menus.find(menu_id);
- if (it == m_menus.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& menu = *(*it).value;
- menu.add_item(make<WSMenuItem>(WSMenuItem::Separator));
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidAddMenuSeparator;
- response.menu.menu_id = menu_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& menu = *(*it).value;
+ menu.add_item(make<WSMenuItem>(identifier, move(text)));
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidAddMenuItem;
+ response.menu.menu_id = menu_id;
+ response.menu.identifier = identifier;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIAddMenuSeparatorRequest& request)
+{
+ int menu_id = request.menu_id();
+ auto it = m_menus.find(menu_id);
+ if (it == m_menus.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APISetWindowTitleRequest: {
- int window_id = static_cast<WSAPISetWindowTitleRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- window.set_title(static_cast<WSAPISetWindowTitleRequest&>(request).title());
- break;
+ auto& menu = *(*it).value;
+ menu.add_item(make<WSMenuItem>(WSMenuItem::Separator));
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidAddMenuSeparator;
+ response.menu.menu_id = menu_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPISetWindowTitleRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIGetWindowTitleRequest: {
- int window_id = static_cast<WSAPIGetWindowTitleRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidGetWindowTitle;
- response.window_id = window.window_id();
- ASSERT(window.title().length() < sizeof(response.text));
- strcpy(response.text, window.title().characters());
- response.text_length = window.title().length();
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& window = *(*it).value;
+ window.set_title(request.title());
+}
+
+void WSClientConnection::handle_request(WSAPIGetWindowTitleRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APISetWindowRectRequest: {
- int window_id = static_cast<WSAPISetWindowRectRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- window.set_rect(static_cast<WSAPISetWindowRectRequest&>(request).rect());
- break;
+ auto& window = *(*it).value;
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidGetWindowTitle;
+ response.window_id = window.window_id();
+ ASSERT(window.title().length() < sizeof(response.text));
+ strcpy(response.text, window.title().characters());
+ response.text_length = window.title().length();
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPISetWindowRectRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIGetWindowRectRequest: {
- int window_id = static_cast<WSAPIGetWindowRectRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidGetWindowRect;
- response.window_id = window.window_id();
- response.window.rect = window.rect();
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& window = *(*it).value;
+ window.set_rect(request.rect());
+}
+
+void WSClientConnection::handle_request(WSAPIGetWindowRectRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APICreateWindowRequest: {
- int window_id = m_next_window_id++;
- auto window = make<WSWindow>(request.client_id(), window_id);
- window->set_title(static_cast<WSAPICreateWindowRequest&>(request).title());
- window->set_rect(static_cast<WSAPICreateWindowRequest&>(request).rect());
- m_windows.set(window_id, move(window));
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidCreateWindow;
- response.window_id = window_id;
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ auto& window = *(*it).value;
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidGetWindowRect;
+ response.window_id = window.window_id();
+ response.window.rect = window.rect();
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPICreateWindowRequest& request)
+{
+ int window_id = m_next_window_id++;
+ auto window = make<WSWindow>(request.client_id(), window_id);
+ window->set_title(request.title());
+ window->set_rect(request.rect());
+ m_windows.set(window_id, move(window));
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidCreateWindow;
+ response.window_id = window_id;
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIDestroyWindowRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIDestroyWindowRequest: {
- int window_id = static_cast<WSAPIGetWindowRectRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- WSWindowManager::the().invalidate(window);
- m_windows.remove(it);
- break;
+ auto& window = *(*it).value;
+ WSWindowManager::the().invalidate(window);
+ m_windows.remove(it);
+}
+
+void WSClientConnection::handle_request(WSAPIInvalidateRectRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIInvalidateRectRequest: {
- int window_id = static_cast<WSAPIInvalidateRectRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::Paint;
- response.window_id = window_id;
- response.paint.rect = static_cast<WSAPIInvalidateRectRequest&>(request).rect();
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::Paint;
+ response.window_id = window_id;
+ response.paint.rect = request.rect();
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIDidFinishPaintingNotification& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIDidFinishPaintingNotification: {
- int window_id = static_cast<WSAPIDidFinishPaintingNotification&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- WSWindowManager::the().invalidate(window, static_cast<WSAPIDidFinishPaintingNotification&>(request).rect());
- break;
+ auto& window = *(*it).value;
+ WSWindowManager::the().invalidate(window, request.rect());
+}
+
+void WSClientConnection::handle_request(WSAPIGetWindowBackingStoreRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
- case WSMessage::APIGetWindowBackingStoreRequest: {
- int window_id = static_cast<WSAPIGetWindowBackingStoreRequest&>(request).window_id();
- auto it = m_windows.find(window_id);
- if (it == m_windows.end()) {
- ASSERT_NOT_REACHED();
- }
- auto& window = *(*it).value;
- auto* backing_store = window.backing();
+ auto& window = *(*it).value;
+ auto* backing_store = window.backing();
- // FIXME: It shouldn't work this way!
- backing_store->retain();
+ // FIXME: It shouldn't work this way!
+ backing_store->retain();
- GUI_ServerMessage response;
- response.type = GUI_ServerMessage::Type::DidGetWindowBackingStore;
- response.window_id = window_id;
- response.backing.backing_store_id = backing_store;
- response.backing.bpp = sizeof(RGBA32);
- response.backing.pitch = backing_store->pitch();
- response.backing.size = backing_store->size();
- response.backing.pixels = reinterpret_cast<RGBA32*>(backing_store->client_region()->laddr().as_ptr());
- WSMessageLoop::the().post_message_to_client(request.client_id(), response);
- break;
- }
- case WSMessage::APIReleaseWindowBackingStoreRequest: {
- int backing_store_id = static_cast<WSAPIReleaseWindowBackingStoreRequest&>(request).backing_store_id();
- // FIXME: It shouldn't work this way!
- auto* backing_store = (GraphicsBitmap*)backing_store_id;
- backing_store->release();
- break;
+ GUI_ServerMessage response;
+ response.type = GUI_ServerMessage::Type::DidGetWindowBackingStore;
+ response.window_id = window_id;
+ response.backing.backing_store_id = backing_store;
+ response.backing.bpp = sizeof(RGBA32);
+ response.backing.pitch = backing_store->pitch();
+ response.backing.size = backing_store->size();
+ response.backing.pixels = reinterpret_cast<RGBA32*>(backing_store->client_region()->laddr().as_ptr());
+ WSMessageLoop::the().post_message_to_client(request.client_id(), response);
+}
+
+void WSClientConnection::handle_request(WSAPIReleaseWindowBackingStoreRequest& request)
+{
+ int backing_store_id = request.backing_store_id();
+ // FIXME: It shouldn't work this way!
+ auto* backing_store = (GraphicsBitmap*)backing_store_id;
+ backing_store->release();
+}
+
+void WSClientConnection::handle_request(WSAPISetGlobalCursorTrackingRequest& request)
+{
+ int window_id = request.window_id();
+ auto it = m_windows.find(window_id);
+ if (it == m_windows.end()) {
+ ASSERT_NOT_REACHED();
}
+ auto& window = *(*it).value;
+ window.set_global_cursor_tracking_enabled(request.value());
+}
+
+void WSClientConnection::on_request(WSAPIClientRequest& request)
+{
+ switch (request.type()) {
+ case WSMessage::APICreateMenubarRequest:
+ return handle_request(static_cast<WSAPICreateMenubarRequest&>(request));
+ case WSMessage::APIDestroyMenubarRequest:
+ return handle_request(static_cast<WSAPIDestroyMenubarRequest&>(request));
+ case WSMessage::APICreateMenuRequest:
+ return handle_request(static_cast<WSAPICreateMenuRequest&>(request));
+ case WSMessage::APIDestroyMenuRequest:
+ return handle_request(static_cast<WSAPIDestroyMenuRequest&>(request));
+ case WSMessage::APISetApplicationMenubarRequest:
+ return handle_request(static_cast<WSAPISetApplicationMenubarRequest&>(request));
+ case WSMessage::APIAddMenuToMenubarRequest:
+ return handle_request(static_cast<WSAPIAddMenuToMenubarRequest&>(request));
+ case WSMessage::APIAddMenuItemRequest:
+ return handle_request(static_cast<WSAPIAddMenuItemRequest&>(request));
+ case WSMessage::APIAddMenuSeparatorRequest:
+ return handle_request(static_cast<WSAPIAddMenuSeparatorRequest&>(request));
+ case WSMessage::APISetWindowTitleRequest:
+ return handle_request(static_cast<WSAPISetWindowTitleRequest&>(request));
+ case WSMessage::APIGetWindowTitleRequest:
+ return handle_request(static_cast<WSAPIGetWindowTitleRequest&>(request));
+ case WSMessage::APISetWindowRectRequest:
+ return handle_request(static_cast<WSAPISetWindowRectRequest&>(request));
+ case WSMessage::APIGetWindowRectRequest:
+ return handle_request(static_cast<WSAPIGetWindowRectRequest&>(request));
+ case WSMessage::APICreateWindowRequest:
+ return handle_request(static_cast<WSAPICreateWindowRequest&>(request));
+ case WSMessage::APIDestroyWindowRequest:
+ return handle_request(static_cast<WSAPIDestroyWindowRequest&>(request));
+ case WSMessage::APIInvalidateRectRequest:
+ return handle_request(static_cast<WSAPIInvalidateRectRequest&>(request));
+ case WSMessage::APIDidFinishPaintingNotification:
+ return handle_request(static_cast<WSAPIDidFinishPaintingNotification&>(request));
+ case WSMessage::APIGetWindowBackingStoreRequest:
+ return handle_request(static_cast<WSAPIGetWindowBackingStoreRequest&>(request));
+ case WSMessage::APIReleaseWindowBackingStoreRequest:
+ return handle_request(static_cast<WSAPIReleaseWindowBackingStoreRequest&>(request));
+ case WSMessage::APISetGlobalCursorTrackingRequest:
+ return handle_request(static_cast<WSAPISetGlobalCursorTrackingRequest&>(request));
default:
break;
}
diff --git a/WindowServer/WSClientConnection.h b/WindowServer/WSClientConnection.h
index 529447c469..84bb549b9e 100644
--- a/WindowServer/WSClientConnection.h
+++ b/WindowServer/WSClientConnection.h
@@ -4,11 +4,11 @@
#include <AK/OwnPtr.h>
#include <AK/WeakPtr.h>
#include <WindowServer/WSMessageReceiver.h>
+#include <WindowServer/WSMessage.h>
class WSWindow;
class WSMenu;
class WSMenuBar;
-class WSAPIClientRequest;
// FIXME: Remove.
class Process;
@@ -30,7 +30,26 @@ public:
private:
virtual void on_message(WSMessage&) override;
- void handle_client_request(WSAPIClientRequest&);
+ 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(WSAPICreateWindowRequest&);
+ void handle_request(WSAPIDestroyWindowRequest&);
+ void handle_request(WSAPIInvalidateRectRequest&);
+ void handle_request(WSAPIDidFinishPaintingNotification&);
+ void handle_request(WSAPIGetWindowBackingStoreRequest&);
+ void handle_request(WSAPIReleaseWindowBackingStoreRequest&);
+ void handle_request(WSAPISetGlobalCursorTrackingRequest&);
int m_client_id { 0 };
diff --git a/WindowServer/WSMessage.h b/WindowServer/WSMessage.h
index 9c1e6ad912..fa38dfba78 100644
--- a/WindowServer/WSMessage.h
+++ b/WindowServer/WSMessage.h
@@ -87,15 +87,18 @@ private:
class WSAPISetGlobalCursorTrackingRequest : public WSAPIClientRequest {
public:
- WSAPISetGlobalCursorTrackingRequest(int client_id, bool value)
+ WSAPISetGlobalCursorTrackingRequest(int client_id, int window_id, bool value)
: WSAPIClientRequest(WSMessage::APISetGlobalCursorTrackingRequest, client_id)
+ , m_window_id(window_id)
, m_value(value)
{
}
+ int window_id() const { return m_window_id; }
bool value() const { return m_value; }
private:
+ int m_window_id { 0 };
bool m_value { false };
};
diff --git a/WindowServer/WSMessageLoop.cpp b/WindowServer/WSMessageLoop.cpp
index 40b3cb1a16..1898c55d8d 100644
--- a/WindowServer/WSMessageLoop.cpp
+++ b/WindowServer/WSMessageLoop.cpp
@@ -344,7 +344,7 @@ ssize_t WSMessageLoop::on_receive_from_client(int client_id, const byte* data, s
post_message(client, make<WSAPIReleaseWindowBackingStoreRequest>(client_id, (int)message.backing.backing_store_id));
break;
case GUI_ClientMessage::Type::SetGlobalCursorTracking:
- post_message(client, make<WSAPISetGlobalCursorTrackingRequest>(client_id, message.value));
+ post_message(client, make<WSAPISetGlobalCursorTrackingRequest>(client_id, message.window_id, message.value));
break;
}
server_process().request_wakeup();