summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com>2025-12-14 19:46:49 +0000
committerGitHub <noreply@github.com>2025-12-14 19:46:49 +0000
commit7ccc57eb7cacded5e7a8835b705bba48963d3cb3 (patch)
tree0bc87ed7beeeb19039bd3a40bf1c3febc36c851b /src
parente4a8f2b14f789075612bfd26e8153039c8f295f2 (diff)
animation: migrate PHLANIMVAR from SP to UP (#12486)
Diffstat (limited to 'src')
-rw-r--r--src/desktop/view/Window.cpp17
-rw-r--r--src/helpers/AnimatedVariable.hpp2
-rw-r--r--src/managers/animation/AnimationManager.cpp3
-rw-r--r--src/managers/animation/AnimationManager.hpp10
4 files changed, 13 insertions, 19 deletions
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index b01dcabc..2fc15566 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -639,14 +639,13 @@ void CWindow::onMap() {
}
void CWindow::onBorderAngleAnimEnd(WP<CBaseAnimatedVariable> pav) {
- const auto PAV = pav.lock();
- if (!PAV)
+ if (!pav)
return;
- if (PAV->getStyle() != "loop" || !PAV->enabled())
+ if (pav->getStyle() != "loop" || !pav->enabled())
return;
- const auto PANIMVAR = dc<CAnimatedVariable<float>*>(PAV.get());
+ const auto PANIMVAR = dc<CAnimatedVariable<float>*>(pav.get());
PANIMVAR->setCallbackOnEnd(nullptr); // we remove the callback here because otherwise setvalueandwarp will recurse this
@@ -1912,16 +1911,14 @@ std::optional<Vector2D> CWindow::calculateExpression(const std::string& s) {
}
static void setVector2DAnimToMove(WP<CBaseAnimatedVariable> pav) {
- const auto PAV = pav.lock();
- if (!PAV)
+ if (!pav)
return;
- CAnimatedVariable<Vector2D>* animvar = dc<CAnimatedVariable<Vector2D>*>(PAV.get());
+ CAnimatedVariable<Vector2D>* animvar = dc<CAnimatedVariable<Vector2D>*>(pav.get());
animvar->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
- const auto PHLWINDOW = animvar->m_Context.pWindow.lock();
- if (PHLWINDOW)
- PHLWINDOW->m_animatingIn = false;
+ if (animvar->m_Context.pWindow)
+ animvar->m_Context.pWindow->m_animatingIn = false;
}
void CWindow::mapWindow() {
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index e7d5fd8c..f0bdc5a8 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -67,7 +67,7 @@ template <Animable VarType>
using CAnimatedVariable = Hyprutils::Animation::CGenericAnimatedVariable<VarType, SAnimationContext>;
template <Animable VarType>
-using PHLANIMVAR = SP<CAnimatedVariable<VarType>>;
+using PHLANIMVAR = UP<CAnimatedVariable<VarType>>;
template <Animable VarType>
using PHLANIMVARREF = WP<CAnimatedVariable<VarType>>;
diff --git a/src/managers/animation/AnimationManager.cpp b/src/managers/animation/AnimationManager.cpp
index a09f391b..b4255a33 100644
--- a/src/managers/animation/AnimationManager.cpp
+++ b/src/managers/animation/AnimationManager.cpp
@@ -209,8 +209,7 @@ void CHyprAnimationManager::tick() {
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
- for (size_t i = 0; i < m_vActiveAnimatedVariables.size(); i++) {
- const auto PAV = m_vActiveAnimatedVariables[i].lock();
+ for (const auto& PAV : m_vActiveAnimatedVariables) {
if (!PAV)
continue;
diff --git a/src/managers/animation/AnimationManager.hpp b/src/managers/animation/AnimationManager.hpp
index 2f411879..b8acc53e 100644
--- a/src/managers/animation/AnimationManager.hpp
+++ b/src/managers/animation/AnimationManager.hpp
@@ -22,13 +22,11 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager {
template <Animable VarType>
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig, eAVarDamagePolicy policy) {
constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType<VarType>;
- const auto PAV = makeShared<CAnimatedVariable<VarType>>();
+ pav = makeUnique<CAnimatedVariable<VarType>>();
- PAV->create(EAVTYPE, sc<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
- PAV->setConfig(pConfig);
- PAV->m_Context.eDamagePolicy = policy;
-
- pav = std::move(PAV);
+ pav->create2(EAVTYPE, sc<Hyprutils::Animation::CAnimationManager*>(this), pav, v);
+ pav->setConfig(pConfig);
+ pav->m_Context.eDamagePolicy = policy;
}
template <Animable VarType>