Hyprland/src/managers/EventManager.hpp

36 lines
658 B
C++
Raw Normal View History

#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();
2022-06-29 18:19:06 +02:00
void postEvent(const SHyprIPCEvent event, bool force = false);
void startThread();
bool m_bIgnoreEvents = false;
std::thread m_tThread;
private:
void flushEvents();
std::mutex eventQueueMutex;
std::deque<SHyprIPCEvent> m_dQueuedEvents;
2022-10-22 17:15:48 +02:00
std::deque<std::pair<int, wl_event_source*>> m_dAcceptedSocketFDs;
};
inline std::unique_ptr<CEventManager> g_pEventManager;