layerSurface: refactor/move to a memory-safe impl

Makes all the pointers smart to avoid memory issues
Refactors layerSurface code to live inside desktop/layersurface
This commit is contained in:
Vaxry
2024-04-30 02:41:27 +01:00
parent 5e6f7b1cdb
commit 5edc32930d
26 changed files with 874 additions and 864 deletions

View File

@@ -49,11 +49,11 @@ enum AVARDAMAGEPOLICY {
};
class CAnimationManager;
struct SLayerSurface;
struct SAnimationPropertyConfig;
class CHyprRenderer;
class CWindow;
class CWorkspace;
class CLayerSurface;
// Utility to define a concept as a list of possible type
template <class T, class... U>
@@ -69,7 +69,7 @@ class CBaseAnimatedVariable {
public:
CBaseAnimatedVariable(ANIMATEDVARTYPE type);
void create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy);
void create(SAnimationPropertyConfig* pAnimConfig, SLayerSurface* pLayer, AVARDAMAGEPOLICY policy);
void create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, AVARDAMAGEPOLICY policy);
void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy);
void create(SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy);
@@ -147,7 +147,7 @@ class CBaseAnimatedVariable {
protected:
PHLWINDOWREF m_pWindow;
std::weak_ptr<CWorkspace> m_pWorkspace;
void* m_pLayer = nullptr;
PHLLSREF m_pLayer;
SAnimationPropertyConfig* m_pConfig = nullptr;
@@ -199,7 +199,7 @@ class CBaseAnimatedVariable {
friend class CAnimationManager;
friend class CWorkspace;
friend struct SLayerSurface;
friend class CLayerSurface;
friend class CHyprRenderer;
};
@@ -213,7 +213,7 @@ class CAnimatedVariable : public CBaseAnimatedVariable {
m_Value = value;
m_Goal = value;
}
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, SLayerSurface* pLayer, AVARDAMAGEPOLICY policy) {
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, AVARDAMAGEPOLICY policy) {
create(pAnimConfig, pLayer, policy);
m_Value = value;
m_Goal = value;
@@ -304,6 +304,6 @@ class CAnimatedVariable : public CBaseAnimatedVariable {
friend class CAnimationManager;
friend class CWorkspace;
friend struct SLayerSurface;
friend class CLayerSurface;
friend class CHyprRenderer;
};