1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 06:25:01 +00:00

WindowServer: Port to the new IPC system

This patch introduces code generation for the WindowServer IPC with
its clients. The client/server endpoints are defined by the two .ipc
files in Servers/WindowServer/: WindowServer.ipc and WindowClient.ipc

It now becomes significantly easier to add features and capabilities
to WindowServer since you don't have to know nearly as much about all
the intricate paths that IPC messages take between LibGUI and WSWindow.

The new system also uses significantly less IPC bandwidth since we're
now doing packed serialization instead of passing fixed-sized structs
of ~600 bytes for each message.

Some repaint coalescing optimizations are lost in this conversion and
we'll need to look at how to implement those in the new world.

The old CoreIPC::Client::Connection and CoreIPC::Server::Connection
classes are removed by this patch and replaced by use of ConnectionNG,
which will be renamed eventually.

Goodbye, old WindowServer IPC. You served us well :^)
This commit is contained in:
Andreas Kling 2019-12-02 09:33:37 +01:00
parent 30db7813de
commit 272d65e3e2
42 changed files with 843 additions and 2853 deletions

View file

@ -2,7 +2,6 @@
#include <LibGUI/GMenu.h>
#include <LibGUI/GMenuItem.h>
#include <LibGUI/GWindowServerConnection.h>
#include <WindowServer/WSAPITypes.h>
GMenuItem::GMenuItem(unsigned menu_id, Type type)
: m_type(type)
@ -57,26 +56,5 @@ void GMenuItem::update_window_server()
if (m_menu_id < 0)
return;
auto& action = *m_action;
WSAPI_ClientMessage request;
request.type = WSAPI_ClientMessage::Type::UpdateMenuItem;
request.menu.menu_id = m_menu_id;
request.menu.identifier = m_identifier;
request.menu.enabled = action.is_enabled();
request.menu.checkable = action.is_checkable();
if (action.is_checkable())
request.menu.checked = action.is_checked();
ASSERT(action.text().length() < (ssize_t)sizeof(request.text));
strcpy(request.text, action.text().characters());
request.text_length = action.text().length();
if (action.shortcut().is_valid()) {
auto shortcut_text = action.shortcut().to_string();
ASSERT(shortcut_text.length() < (ssize_t)sizeof(request.menu.shortcut_text));
strcpy(request.menu.shortcut_text, shortcut_text.characters());
request.menu.shortcut_text_length = shortcut_text.length();
} else {
request.menu.shortcut_text_length = 0;
}
GWindowServerConnection::the().sync_request(request, WSAPI_ServerMessage::Type::DidUpdateMenuItem);
GWindowServerConnection::the().send_sync<WindowServer::UpdateMenuItem>(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, action.shortcut().to_string());
}