mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
animationmgr: Optimize CAnimationManager::scheduleTick a bit. (#3172)
* Optimize CAnimationManager::scheduleTick a bit. * Use integer in wl_event_source_timer_update call.
This commit is contained in:
parent
db48f973fd
commit
28f1f035b1
@ -539,15 +539,14 @@ void CAnimationManager::scheduleTick() {
|
||||
|
||||
const auto PMOSTHZ = g_pHyprRenderer->m_pMostHzMonitor;
|
||||
|
||||
float refreshRate = PMOSTHZ ? PMOSTHZ->refreshRate : 60.f;
|
||||
float refreshDelayMs = std::floor(1000.0 / refreshRate);
|
||||
|
||||
if (!PMOSTHZ) {
|
||||
wl_event_source_timer_update(m_pAnimationTick, refreshDelayMs);
|
||||
wl_event_source_timer_update(m_pAnimationTick, 16);
|
||||
return;
|
||||
}
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.0;
|
||||
float refreshDelayMs = std::floor(1000.f / PMOSTHZ->refreshRate);
|
||||
|
||||
const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.f;
|
||||
|
||||
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user