core: move to hyprutils for utils (#6385)

* 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>
This commit is contained in:
Vaxry 2024-06-11 17:17:45 +02:00 committed by GitHub
parent 1f46296ea0
commit 8c64a4bad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 158 additions and 873 deletions

View file

@ -1,24 +1,5 @@
#pragma once
#include <functional>
#include <any>
#include <vector>
#include <memory>
#include <hyprutils/signal/Signal.hpp>
#include "Listener.hpp"
class CSignal {
public:
void emit(std::any data = {});
//
[[nodiscard("Listener is unregistered when the ptr is lost")]] CHyprSignalListener registerListener(std::function<void(std::any)> handler);
// this is for static listeners. They die with this signal.
// TODO: can we somehow rid of the void* data and make it a custom this?
void registerStaticListener(std::function<void(void*, std::any)> handler, void* owner);
private:
std::vector<WP<CSignalListener>> m_vListeners;
std::vector<std::unique_ptr<CStaticSignalListener>> m_vStaticListeners;
};
using namespace Hyprutils::Signal;