mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 11:05:58 +01:00
8c64a4bad7
* core: move to hyprutils for utils Nix: add hyprutils dep * Meson: add hyprutils dep * flake.lock: update --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
#include <deque>
|
|
#include <vector>
|
|
|
|
#include "../defines.hpp"
|
|
#include "../helpers/memory/Memory.hpp"
|
|
|
|
struct SHyprIPCEvent {
|
|
std::string event;
|
|
std::string data;
|
|
};
|
|
|
|
class CEventManager {
|
|
public:
|
|
CEventManager();
|
|
~CEventManager();
|
|
|
|
void postEvent(const SHyprIPCEvent& event);
|
|
|
|
private:
|
|
std::string formatEvent(const SHyprIPCEvent& event) const;
|
|
|
|
static int onServerEvent(int fd, uint32_t mask, void* data);
|
|
static int onClientEvent(int fd, uint32_t mask, void* data);
|
|
|
|
int onServerEvent(int fd, uint32_t mask);
|
|
int onClientEvent(int fd, uint32_t mask);
|
|
|
|
struct SClient {
|
|
int fd = -1;
|
|
std::deque<SP<std::string>> events;
|
|
wl_event_source* eventSource = nullptr;
|
|
};
|
|
|
|
std::vector<SClient>::iterator findClientByFD(int fd);
|
|
std::vector<SClient>::iterator removeClientByFD(int fd);
|
|
|
|
private:
|
|
int m_iSocketFD = -1;
|
|
wl_event_source* m_pEventSource = nullptr;
|
|
|
|
std::vector<SClient> m_vClients;
|
|
};
|
|
|
|
inline std::unique_ptr<CEventManager> g_pEventManager;
|