2022-03-28 22:31:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../includes.hpp"
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
class CHyprWLListener {
|
|
|
|
public:
|
|
|
|
CHyprWLListener(wl_signal*, std::function<void(void*, void*)>, void* owner);
|
|
|
|
CHyprWLListener();
|
|
|
|
~CHyprWLListener();
|
|
|
|
|
2022-07-26 21:41:29 +02:00
|
|
|
CHyprWLListener(const CHyprWLListener&) = delete;
|
|
|
|
CHyprWLListener(CHyprWLListener&&) = delete;
|
|
|
|
CHyprWLListener& operator=(const CHyprWLListener&) = delete;
|
|
|
|
CHyprWLListener& operator=(CHyprWLListener&&) = delete;
|
|
|
|
|
2022-03-28 22:31:39 +02:00
|
|
|
void initCallback(wl_signal*, std::function<void(void*, void*)>, void* owner, std::string author = "");
|
|
|
|
|
|
|
|
void removeCallback();
|
|
|
|
|
|
|
|
bool isConnected();
|
|
|
|
|
2022-07-26 21:41:29 +02:00
|
|
|
struct SWrapper {
|
|
|
|
wl_listener m_sListener;
|
|
|
|
CHyprWLListener* m_pSelf;
|
|
|
|
};
|
2022-03-28 22:31:39 +02:00
|
|
|
|
|
|
|
void emit(void*);
|
|
|
|
|
|
|
|
private:
|
2022-07-26 21:41:29 +02:00
|
|
|
SWrapper m_swWrapper;
|
2022-03-28 22:31:39 +02:00
|
|
|
|
|
|
|
void* m_pOwner = nullptr;
|
|
|
|
|
|
|
|
std::function<void(void*, void*)> m_pCallback = nullptr;
|
|
|
|
|
|
|
|
std::string m_szAuthor = "";
|
|
|
|
};
|