1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 17:25:08 +00:00
serenity/Userland/Services/WindowServer/EventLoop.h
Andreas Kling 6d0f504822 LibIPC: Add IPC::MultiServer convenience class
This encapsulates what our multi-client IPC servers typically do on
startup:

    1. Create a Core::LocalServer
    2. Take over a listening socket file descriptor from SystemServer
    3. Set up an accept handler for incoming connections

IPC::MultiServer does all this for you! All you have to do is provide
the relevant client connection type as a template argument.
2021-12-06 19:22:16 +01:00

40 lines
860 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "ClientConnection.h"
#include "WMClientConnection.h"
#include <AK/ByteBuffer.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Notifier.h>
#include <LibIPC/MultiServer.h>
namespace WindowServer {
class ClientConnection;
class EventLoop {
public:
EventLoop();
virtual ~EventLoop();
int exec() { return m_event_loop.exec(); }
private:
void drain_mouse();
void drain_keyboard();
Core::EventLoop m_event_loop;
int m_keyboard_fd { -1 };
RefPtr<Core::Notifier> m_keyboard_notifier;
int m_mouse_fd { -1 };
RefPtr<Core::Notifier> m_mouse_notifier;
OwnPtr<IPC::MultiServer<ClientConnection>> m_window_server;
OwnPtr<IPC::MultiServer<WMClientConnection>> m_wm_server;
};
}