2022-05-24 19:42:43 +02:00
|
|
|
#pragma once
|
|
|
|
#include <deque>
|
|
|
|
#include <fstream>
|
2022-05-25 17:26:26 +02:00
|
|
|
#include <mutex>
|
2022-05-24 19:42:43 +02:00
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include "../helpers/MiscFunctions.hpp"
|
|
|
|
|
|
|
|
struct SHyprIPCEvent {
|
|
|
|
std::string event;
|
|
|
|
std::string data;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CEventManager {
|
2022-12-16 18:17:31 +01:00
|
|
|
public:
|
2022-05-24 19:42:43 +02:00
|
|
|
CEventManager();
|
|
|
|
|
2023-07-06 15:23:11 +02:00
|
|
|
void postEvent(const SHyprIPCEvent event);
|
2022-05-24 19:42:43 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
void startThread();
|
2022-05-24 19:42:43 +02:00
|
|
|
|
2022-08-28 11:19:08 +02:00
|
|
|
std::thread m_tThread;
|
2023-12-06 23:54:56 +01:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
private:
|
|
|
|
void flushEvents();
|
2022-05-24 19:42:43 +02:00
|
|
|
|
2022-12-16 18:17:31 +01:00
|
|
|
std::mutex eventQueueMutex;
|
|
|
|
std::deque<SHyprIPCEvent> m_dQueuedEvents;
|
2022-05-24 19:42:43 +02:00
|
|
|
|
2022-10-22 17:15:48 +02:00
|
|
|
std::deque<std::pair<int, wl_event_source*>> m_dAcceptedSocketFDs;
|
2022-05-24 19:42:43 +02:00
|
|
|
};
|
|
|
|
|
2023-07-06 15:23:11 +02:00
|
|
|
inline std::unique_ptr<CEventManager> g_pEventManager;
|