Multiple animation optimization and xwayland wine fixes

This commit is contained in:
vaxerski
2022-11-04 15:56:31 +00:00
parent 34ad837fd9
commit 206360177f
10 changed files with 96 additions and 15 deletions

View File

@@ -32,6 +32,7 @@ public:
~CAnimatedVariable();
void unregister();
void registerVar();
// gets the current vector value (real time)
const Vector2D& vec() const {
@@ -167,6 +168,16 @@ public:
int getDurationLeftMs();
/* sets a function to be ran when the animation finishes.
if an animation is not running, runs instantly.
will remove the callback when ran. */
void setCallbackOnEnd(std::function<void(void* thisptr)> func) {
m_fEndCallback = func;
if (!isBeingAnimated())
onAnimationEnd();
}
private:
Vector2D m_vValue = Vector2D(0,0);
@@ -195,6 +206,16 @@ private:
ANIMATEDVARTYPE m_eVarType = AVARTYPE_INVALID;
AVARDAMAGEPOLICY m_eDamagePolicy = AVARDAMAGE_INVALID;
std::function<void(void* thisptr)> m_fEndCallback;
// methods
void onAnimationEnd() {
if (m_fEndCallback) {
m_fEndCallback(this);
m_fEndCallback = nullptr; // reset
}
}
friend class CAnimationManager;
friend class CWorkspace;
friend struct SLayerSurface;