Serenity Operating System
1/*
2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include "ConnectionFromClient.h"
10#include "WMConnectionFromClient.h"
11#include <AK/ByteBuffer.h>
12#include <LibCore/EventLoop.h>
13#include <LibCore/Notifier.h>
14#include <LibIPC/MultiServer.h>
15
16namespace WindowServer {
17
18class ConnectionFromClient;
19
20class EventLoop {
21public:
22 EventLoop();
23 virtual ~EventLoop() = default;
24
25 int exec() { return m_event_loop.exec(); }
26
27private:
28 void drain_mouse();
29 void drain_keyboard();
30
31 Core::EventLoop m_event_loop;
32 int m_keyboard_fd { -1 };
33 RefPtr<Core::Notifier> m_keyboard_notifier;
34 int m_mouse_fd { -1 };
35 RefPtr<Core::Notifier> m_mouse_notifier;
36 OwnPtr<IPC::MultiServer<ConnectionFromClient>> m_window_server;
37 OwnPtr<IPC::MultiServer<WMConnectionFromClient>> m_wm_server;
38};
39
40}