summaryrefslogtreecommitdiff
path: root/src/hyprerror/HyprError.cpp
diff options
context:
space:
mode:
authorMaximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com>2025-01-07 17:55:14 +0000
committerGitHub <noreply@github.com>2025-01-07 17:55:14 +0000
commit5642ed331df56375c55cd8d56a14054af8bdf8f2 (patch)
tree74a85b022b3319cdfad01343358eaf09a94841d1 /src/hyprerror/HyprError.cpp
parentc7086f936a06abebcc863c35f634760ca1ee90c0 (diff)
core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation * config: move animation config to hyprutils animation tree * use g_pAnimationManager->createAnimation and the new PHLANIMVAR template * core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks * core: adapt animated variable usage (dereference the shared pointer) * misc: bump CMakeLists to hyprutils 0.3.3
Diffstat (limited to 'src/hyprerror/HyprError.cpp')
-rw-r--r--src/hyprerror/HyprError.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/hyprerror/HyprError.cpp b/src/hyprerror/HyprError.cpp
index d3cd8273..5e0dcf5e 100644
--- a/src/hyprerror/HyprError.cpp
+++ b/src/hyprerror/HyprError.cpp
@@ -3,13 +3,13 @@
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"
#include "../render/pass/TexPassElement.hpp"
+#include "../managers/AnimationManager.hpp"
#include <hyprutils/utils/ScopeGuard.hpp>
-using namespace Hyprutils::Utils;
+using namespace Hyprutils::Animation;
CHyprError::CHyprError() {
- m_fFadeOpacity.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), AVARDAMAGE_NONE);
- m_fFadeOpacity.registerVar();
+ g_pAnimationManager->createAnimation(0.f, m_fFadeOpacity, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), AVARDAMAGE_NONE);
static auto P = g_pHookSystem->hookDynamic("focusedMon", [&](void* self, SCallbackInfo& info, std::any param) {
if (!m_bIsCreated)
@@ -23,16 +23,14 @@ CHyprError::CHyprError() {
if (!m_bIsCreated)
return;
- if (m_fFadeOpacity.isBeingAnimated() || m_bMonitorChanged)
+ if (m_fFadeOpacity->isBeingAnimated() || m_bMonitorChanged)
g_pHyprRenderer->damageBox(&m_bDamageBox);
});
m_pTexture = makeShared<CTexture>();
}
-CHyprError::~CHyprError() {
- m_fFadeOpacity.unregister();
-}
+CHyprError::~CHyprError() = default;
void CHyprError::queueCreate(std::string message, const CHyprColor& color) {
m_szQueued = message;
@@ -43,10 +41,10 @@ void CHyprError::createQueued() {
if (m_bIsCreated)
m_pTexture->destroyTexture();
- m_fFadeOpacity.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
+ m_fFadeOpacity->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
- m_fFadeOpacity.setValueAndWarp(0.f);
- m_fFadeOpacity = 1.f;
+ m_fFadeOpacity->setValueAndWarp(0.f);
+ *m_fFadeOpacity = 1.f;
const auto PMONITOR = g_pCompositor->m_vMonitors.front();
@@ -176,8 +174,8 @@ void CHyprError::draw() {
}
if (m_bQueuedDestroy) {
- if (!m_fFadeOpacity.isBeingAnimated()) {
- if (m_fFadeOpacity.value() == 0.f) {
+ if (!m_fFadeOpacity->isBeingAnimated()) {
+ if (m_fFadeOpacity->value() == 0.f) {
m_bQueuedDestroy = false;
m_pTexture->destroyTexture();
m_bIsCreated = false;
@@ -189,8 +187,8 @@ void CHyprError::draw() {
return;
} else {
- m_fFadeOpacity.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
- m_fFadeOpacity = 0.f;
+ m_fFadeOpacity->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
+ *m_fFadeOpacity = 0.f;
}
}
}
@@ -202,7 +200,7 @@ void CHyprError::draw() {
m_bDamageBox.x = (int)PMONITOR->vecPosition.x;
m_bDamageBox.y = (int)PMONITOR->vecPosition.y;
- if (m_fFadeOpacity.isBeingAnimated() || m_bMonitorChanged)
+ if (m_fFadeOpacity->isBeingAnimated() || m_bMonitorChanged)
g_pHyprRenderer->damageBox(&m_bDamageBox);
m_bMonitorChanged = false;
@@ -210,7 +208,7 @@ void CHyprError::draw() {
CTexPassElement::SRenderData data;
data.tex = m_pTexture;
data.box = monbox;
- data.a = m_fFadeOpacity.value();
+ data.a = m_fFadeOpacity->value();
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
}