summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/EventLoop.h
blob: f0125bc11921125dcbf7d917dfd2549f2c1a1b63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "ConnectionFromClient.h"
#include "WMConnectionFromClient.h"
#include <AK/ByteBuffer.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Notifier.h>
#include <LibIPC/MultiServer.h>

namespace WindowServer {

class ConnectionFromClient;

class EventLoop {
public:
    EventLoop();
    virtual ~EventLoop() = default;

    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<ConnectionFromClient>> m_window_server;
    OwnPtr<IPC::MultiServer<WMConnectionFromClient>> m_wm_server;
};

}