Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,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

Expand Down
10 changes: 4 additions & 6 deletions src/events/Windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,14 @@ using namespace Hyprutils::Animation;
// ------------------------------------------------------------ //

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 Events::listener_mapWindow(void* owner, void* data) {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/AnimatedVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>>;
3 changes: 1 addition & 2 deletions src/managers/animation/AnimationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 4 additions & 6 deletions src/managers/animation/AnimationManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading