Skip to content

Commit 934adb0

Browse files
animation: move PHLANIMVAR from SP to UP
1 parent 9174fa1 commit 934adb0

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/core/AnimatedVariable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace Hyprtoolkit {
6363
using CAnimatedVariable = Hyprutils::Animation::CGenericAnimatedVariable<VarType, SAnimationContext>;
6464

6565
template <Animable VarType>
66-
using PHLANIMVAR = SP<CAnimatedVariable<VarType>>;
66+
using PHLANIMVAR = UP<CAnimatedVariable<VarType>>;
6767

6868
template <Animable VarType>
6969
using PHLANIMVARREF = WP<CAnimatedVariable<VarType>>;

src/core/AnimationManager.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ static void updateColorVariable(CAnimatedVariable<CHyprColor>& av, const float P
8686
// }
8787

8888
void CHTAnimationManager::tick() {
89-
for (size_t i = 0; i < m_vActiveAnimatedVariables.size(); i++) {
90-
const auto PAV = m_vActiveAnimatedVariables[i].lock();
89+
for (const auto& PAV : m_vActiveAnimatedVariables) {
9190
if (!PAV || !PAV->ok())
9291
continue;
9392

src/core/AnimationManager.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ namespace Hyprtoolkit {
1919
template <Animable VarType>
2020
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig) {
2121
constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType<VarType>;
22-
const auto PAV = makeShared<CAnimatedVariable<VarType>>();
22+
pav = makeUnique<CAnimatedVariable<VarType>>();
2323

24-
PAV->create(EAVTYPE, static_cast<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
25-
PAV->setConfig(pConfig);
26-
27-
pav = std::move(PAV);
24+
pav->create(EAVTYPE, static_cast<Hyprutils::Animation::CAnimationManager*>(this), pav, v);
25+
pav->setConfig(pConfig);
2826
}
2927

3028
Hyprutils::Animation::CAnimationConfigTree m_animationTree;

0 commit comments

Comments
 (0)