summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer/EventLoop.h
blob: 2964de84082c32d8b3185179ab72be79f419cb86 (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
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/ByteBuffer.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibCore/Notifier.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;
    RefPtr<Core::LocalServer> m_window_server;
    RefPtr<Core::LocalServer> m_wm_server;
};

}