diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
| commit | 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac (patch) | |
| tree | 5b52ad19c695590ae50c7adae06b8e3aeccf34c1 /src/protocols/GlobalShortcuts.cpp | |
| parent | 0e521788bcc414c9cf81648d3167757d83deb60f (diff) | |
time: move to stl's clocks and move timer
Diffstat (limited to 'src/protocols/GlobalShortcuts.cpp')
| -rw-r--r-- | src/protocols/GlobalShortcuts.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/protocols/GlobalShortcuts.cpp b/src/protocols/GlobalShortcuts.cpp index 9f8f422c..04e4e091 100644 --- a/src/protocols/GlobalShortcuts.cpp +++ b/src/protocols/GlobalShortcuts.cpp @@ -1,4 +1,5 @@ #include "GlobalShortcuts.hpp" +#include "../helpers/time/Time.hpp" CShortcutClient::CShortcutClient(SP<CHyprlandGlobalShortcutsManagerV1> resource_) : resource(resource_) { if UNLIKELY (!good()) @@ -68,14 +69,13 @@ void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::s for (auto const& c : m_vClients) { for (auto const& sh : c->shortcuts) { if (sh->appid == appid && sh->id == trigger) { - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - uint32_t tvSecHi = (sizeof(now.tv_sec) > 4) ? now.tv_sec >> 32 : 0; - uint32_t tvSecLo = now.tv_sec & 0xFFFFFFFF; + const auto [sec, nsec] = Time::secNsec(Time::steadyNow()); + uint32_t tvSecHi = (sizeof(sec) > 4) ? sec >> 32 : 0; + uint32_t tvSecLo = sec & 0xFFFFFFFF; if (pressed) - sh->resource->sendPressed(tvSecHi, tvSecLo, now.tv_nsec); + sh->resource->sendPressed(tvSecHi, tvSecLo, nsec); else - sh->resource->sendReleased(tvSecHi, tvSecLo, now.tv_nsec); + sh->resource->sendReleased(tvSecHi, tvSecLo, nsec); } } } |
