diff --git a/CMakeLists.txt b/CMakeLists.txt index 07a33cb6d..a192a6942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION}) set(AQUAMARINE_MINIMUM_VERSION 0.9.3) set(HYPRLANG_MINIMUM_VERSION 0.6.7) set(HYPRCURSOR_MINIMUM_VERSION 0.1.7) -set(HYPRUTILS_MINIMUM_VERSION 0.10.2) +set(HYPRUTILS_MINIMUM_VERSION 0.11.0) set(HYPRGRAPHICS_MINIMUM_VERSION 0.1.6) pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=${AQUAMARINE_MINIMUM_VERSION}) diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp index b01dcabc0..2fc15566a 100644 --- a/src/desktop/view/Window.cpp +++ b/src/desktop/view/Window.cpp @@ -639,14 +639,13 @@ void CWindow::onMap() { } void CWindow::onBorderAngleAnimEnd(WP 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*>(PAV.get()); + const auto PANIMVAR = dc*>(pav.get()); PANIMVAR->setCallbackOnEnd(nullptr); // we remove the callback here because otherwise setvalueandwarp will recurse this @@ -1912,16 +1911,14 @@ std::optional CWindow::calculateExpression(const std::string& s) { } static void setVector2DAnimToMove(WP pav) { - const auto PAV = pav.lock(); - if (!PAV) + if (!pav) return; - CAnimatedVariable* animvar = dc*>(PAV.get()); + CAnimatedVariable* animvar = dc*>(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 e7d5fd8cd..f0bdc5a81 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -67,7 +67,7 @@ template using CAnimatedVariable = Hyprutils::Animation::CGenericAnimatedVariable; template -using PHLANIMVAR = SP>; +using PHLANIMVAR = UP>; template using PHLANIMVARREF = WP>; diff --git a/src/managers/animation/AnimationManager.cpp b/src/managers/animation/AnimationManager.cpp index a09f391b0..b4255a33c 100644 --- a/src/managers/animation/AnimationManager.cpp +++ b/src/managers/animation/AnimationManager.cpp @@ -209,8 +209,7 @@ void CHyprAnimationManager::tick() { static auto PANIMENABLED = CConfigValue("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 2f411879b..b8acc53e7 100644 --- a/src/managers/animation/AnimationManager.hpp +++ b/src/managers/animation/AnimationManager.hpp @@ -22,13 +22,11 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager { template void createAnimation(const VarType& v, PHLANIMVAR& pav, SP pConfig, eAVarDamagePolicy policy) { constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType; - const auto PAV = makeShared>(); + pav = makeUnique>(); - PAV->create(EAVTYPE, sc(this), PAV, v); - PAV->setConfig(pConfig); - PAV->m_Context.eDamagePolicy = policy; - - pav = std::move(PAV); + pav->create2(EAVTYPE, sc(this), pav, v); + pav->setConfig(pConfig); + pav->m_Context.eDamagePolicy = policy; } template