hyprlock/src/core/Timer.hpp
Maximilian Seidler d84b44e695
core: use hyprutils atomic pointers (#808)
* widgets: move references to hyprutils atomic shared

* core: move std::shared_pointers to hyprutils atomic shared pointers

* Nix: bump hyprutils input

* clang-format

* cmake: bump hyprutils to v0.8.0

* and bump nix again
2025-06-28 11:01:28 +02:00

26 lines
757 B
C++

#pragma once
#include <chrono>
#include <functional>
#include "../defines.hpp"
class CTimer {
public:
CTimer(std::chrono::system_clock::duration timeout, std::function<void(ASP<CTimer> self, void* data)> cb_, void* data_, bool force);
void cancel();
bool passed();
bool canForceUpdate();
float leftMs();
bool cancelled();
void call(ASP<CTimer> self);
private:
std::function<void(ASP<CTimer> self, void* data)> cb;
void* data = nullptr;
std::chrono::system_clock::time_point expires;
bool wasCancelled = false;
bool allowForceUpdate = false;
};