summaryrefslogtreecommitdiff
path: root/src/managers/EventManager.hpp
blob: b9598bcaf40c862bd52b2dea1fe70c3c1f3c9457 (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
#pragma once
#include <deque>
#include <fstream>
#include <mutex>

#include "../defines.hpp"
#include "../helpers/MiscFunctions.hpp"

struct SHyprIPCEvent {
    std::string event;
    std::string data;
};

class CEventManager {
public:
    CEventManager();

    void postEvent(const SHyprIPCEvent event, bool force = false);

    void startThread();

    bool m_bIgnoreEvents = false;

private:

    std::mutex eventQueueMutex;
    std::deque<SHyprIPCEvent> m_dQueuedEvents;

    std::deque<int> m_dAcceptedSocketFDs;
};

inline std::unique_ptr<CEventManager> g_pEventManager;