mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 19:45:58 +01:00
Move AnimationManager::tick() to an event loop
This commit is contained in:
parent
dea71875e4
commit
34685a836a
3 changed files with 16 additions and 1 deletions
|
@ -151,7 +151,6 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
if (PMONITOR->ID == g_pHyprRenderer->m_pMostHzMonitor->ID ||
|
||||
*PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
|
||||
g_pCompositor->sanityCheckWorkspaces();
|
||||
g_pAnimationManager->tick();
|
||||
|
||||
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
|
||||
|
||||
|
|
|
@ -1,9 +1,23 @@
|
|||
#include "AnimationManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
int wlTick(void* data) {
|
||||
|
||||
float refreshRate = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor->refreshRate : 60.f;
|
||||
|
||||
wl_event_source_timer_update(g_pAnimationManager->m_pAnimationTick, 1000 / refreshRate);
|
||||
|
||||
g_pAnimationManager->tick();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CAnimationManager::CAnimationManager() {
|
||||
std::vector<Vector2D> points = {Vector2D(0, 0.75f), Vector2D(0.15f, 1.f)};
|
||||
m_mBezierCurves["default"].setup(&points);
|
||||
|
||||
m_pAnimationTick = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, &wlTick, nullptr);
|
||||
wl_event_source_timer_update(m_pAnimationTick, 1);
|
||||
}
|
||||
|
||||
void CAnimationManager::removeAllBeziers() {
|
||||
|
|
|
@ -26,6 +26,8 @@ class CAnimationManager {
|
|||
|
||||
std::list<CAnimatedVariable*> m_lAnimatedVariables;
|
||||
|
||||
wl_event_source* m_pAnimationTick;
|
||||
|
||||
private:
|
||||
bool deltaSmallToFlip(const Vector2D& a, const Vector2D& b);
|
||||
bool deltaSmallToFlip(const CColor& a, const CColor& b);
|
||||
|
|
Loading…
Reference in a new issue