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

Port the WindowServer and LibGUI to communicate through local sockets.

This is really cool! :^)

Apps currently refuse to start if the WindowServer isn't listening on the
socket in /wsportal. This makes sense, but I guess it would also be nice
to have some sort of "wait for server on startup" mode.

This has performance issues, and I'll work on those, but this stuff seems
to actually work and I'm very happy with that.
This commit is contained in:
Andreas Kling 2019-02-14 17:18:35 +01:00
parent 00319c248c
commit bf58241c11
15 changed files with 190 additions and 51 deletions

View file

@ -3,6 +3,7 @@
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/WeakPtr.h>
#include <AK/Function.h>
#include <SharedGraphics/GraphicsBitmap.h>
#include <WindowServer/WSMessageReceiver.h>
#include <WindowServer/WSMessage.h>
@ -17,18 +18,21 @@ class Process;
class WSClientConnection final : public WSMessageReceiver {
public:
explicit WSClientConnection(int client_id);
explicit WSClientConnection(int fd);
virtual ~WSClientConnection() override;
static WSClientConnection* from_client_id(int client_id);
static WSClientConnection* ensure_for_client_id(int client_id);
static void for_each_client(Function<void(WSClientConnection&)>);
void post_message(GUI_ServerMessage&&);
void post_message(const GUI_ServerMessage&);
RetainPtr<GraphicsBitmap> create_bitmap(const Size&);
int client_id() const { return m_client_id; }
WSMenuBar* app_menubar() { return m_app_menubar.ptr(); }
int fd() const { return m_fd; }
private:
virtual void on_message(WSMessage&) override;
@ -56,6 +60,7 @@ private:
void post_error(const String&);
int m_client_id { 0 };
int m_fd { -1 };
HashMap<int, OwnPtr<WSWindow>> m_windows;
HashMap<int, OwnPtr<WSMenuBar>> m_menubars;