1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:47:35 +00:00

WindowServer+LibGUI: Make client/server greeting faster

Instead of doing a full IPC round-trip for the client and server to
greet each other upon connecting, the server now automatically sends
a "fast_greet" message when a client connects.

The client simply waits for that message to arrive before proceeding.
(Waiting is necessary since LibGUI relies on the palette information
included in the greeting.)
This commit is contained in:
Andreas Kling 2021-05-20 21:42:31 +02:00
parent 1150e9fe79
commit ec8363aec3
6 changed files with 15 additions and 11 deletions

View file

@ -42,9 +42,16 @@ static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer)
void WindowServerConnection::handshake()
{
auto response = greet();
set_system_theme_from_anonymous_buffer(response.theme_buffer());
Desktop::the().did_receive_screen_rect({}, response.screen_rect());
// NOTE: WindowServer automatically sends a "fast_greet" message to us when we connect.
// All we have to do is wait for it to arrive. This avoids a round-trip during application startup.
auto message = wait_for_specific_message<Messages::WindowClient::FastGreet>();
set_system_theme_from_anonymous_buffer(message->theme_buffer());
Desktop::the().did_receive_screen_rect({}, message->screen_rect());
}
void WindowServerConnection::fast_greet(Gfx::IntRect const&, Core::AnonymousBuffer const&)
{
// NOTE: This message is handled in handshake().
}
void WindowServerConnection::update_system_theme(Core::AnonymousBuffer const& theme_buffer)