1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 09:07:44 +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

@ -53,6 +53,8 @@ ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> client_socke
if (!s_connections)
s_connections = new HashMap<int, NonnullRefPtr<ClientConnection>>;
s_connections->set(client_id, *this);
async_fast_greet(Screen::the().rect(), Gfx::current_system_theme_buffer());
}
ClientConnection::~ClientConnection()
@ -681,11 +683,6 @@ void ClientConnection::start_window_resize(i32 window_id)
WindowManager::the().start_window_resize(window, Screen::the().cursor_location(), MouseButton::Left);
}
Messages::WindowServer::GreetResponse ClientConnection::greet()
{
return { Screen::the().rect(), Gfx::current_system_theme_buffer() };
}
Messages::WindowServer::StartDragResponse ClientConnection::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap)
{
auto& wm = WindowManager::the();

View file

@ -88,7 +88,6 @@ private:
void set_unresponsive(bool);
void destroy_window(Window&, Vector<i32>& destroyed_window_ids);
virtual Messages::WindowServer::GreetResponse greet() override;
virtual void create_menubar(i32) override;
virtual void destroy_menubar(i32) override;
virtual void create_menu(i32, String const&) override;

View file

@ -1,5 +1,7 @@
endpoint WindowClient
{
fast_greet(Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer) =|
paint(i32 window_id, Gfx::IntSize window_size, Vector<Gfx::IntRect> rects) =|
mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta, bool is_drag, Vector<String> mime_types) =|
mouse_down(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|

View file

@ -1,7 +1,5 @@
endpoint WindowServer
{
greet() => (Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer)
create_menubar(i32 menubar_id) =|
destroy_menubar(i32 menubar_id) =|