summaryrefslogtreecommitdiff
path: root/src/managers/AnimationManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-16 12:44:45 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-16 12:44:45 +0200
commit48e5bd96bc71f94f774eb92b00ef560b2f911c73 (patch)
tree3d703572b5c7b68068c712f90ed10238846dd714 /src/managers/AnimationManager.cpp
parentb2650928eac06e3181ad07efe6ec55b2550f89b8 (diff)
Added shadow colors animations and inactive col
Diffstat (limited to 'src/managers/AnimationManager.cpp')
-rw-r--r--src/managers/AnimationManager.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 053267e3..a8743afd 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -31,6 +31,7 @@ void CAnimationManager::tick() {
static auto *const PANIMSPEED = &g_pConfigManager->getConfigValuePtr("animations:speed")->floatValue;
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
static auto *const BEZIERSTR = &g_pConfigManager->getConfigValuePtr("animations:curve")->strValue;
+ static auto *const PSHADOWSENABLED = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
auto DEFAULTBEZIER = m_mBezierCurves.find(*BEZIERSTR);
if (DEFAULTBEZIER == m_mBezierCurves.end())
@@ -42,6 +43,11 @@ void CAnimationManager::tick() {
if (!av->isBeingAnimated())
continue;
+ if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
+ av->warp();
+ continue;
+ }
+
// get speed
const auto SPEED = *av->m_pSpeed == 0 ? *PANIMSPEED : *av->m_pSpeed;
@@ -182,6 +188,36 @@ void CAnimationManager::tick() {
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
break;
+ } case AVARDAMAGE_SHADOW: {
+ RASSERT(PWINDOW, "Tried to AVARDAMAGE_SHADOW a non-window AVAR!");
+
+ static auto* const PSHADOWSIZE = &g_pConfigManager->getConfigValuePtr("decoration:shadow_range")->intValue;
+ static auto* const PSHADOWIGNOREWINDOW = &g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window")->intValue;
+
+ const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
+
+ if (PDECO) {
+ const auto EXTENTS = PDECO->getWindowDecorationExtents();
+
+ wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x + EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y + EXTENTS.topLeft.y,
+ PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
+
+ if (!*PSHADOWIGNOREWINDOW) {
+ // easy, damage the entire box
+ g_pHyprRenderer->damageBox(&dmg);
+ } else {
+ pixman_region32_t rg;
+ pixman_region32_init_rect(&rg, dmg.x, dmg.y, dmg.width, dmg.height);
+ pixman_region32_t wb;
+ pixman_region32_init_rect(&wb, PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y);
+ pixman_region32_subtract(&rg, &rg, &wb);
+ g_pHyprRenderer->damageRegion(&rg);
+ pixman_region32_fini(&rg);
+ pixman_region32_fini(&wb);
+ }
+ }
+
+ break;
}
default: {
Debug::log(ERR, "av has damage policy INVALID???");