diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-12 11:27:31 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-12 11:27:31 +0200 |
| commit | ff0f535c28018eeb5164f3576904748b73136202 (patch) | |
| tree | 0180a5d51034754efe36c6bc352eb198aca4827c /src/managers/AnimationManager.cpp | |
| parent | 07e208aa73a69505264e8a2922699e09ad708d58 (diff) | |
Added workspace animations
Diffstat (limited to 'src/managers/AnimationManager.cpp')
| -rw-r--r-- | src/managers/AnimationManager.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 4052c7e2..639be55e 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -40,17 +40,27 @@ void CAnimationManager::tick() { // window stuff const auto PWINDOW = (CWindow*)av->m_pWindow; - wlr_box WLRBOXPREV = {PWINDOW->m_vRealPosition.vec().x - BORDERSIZE - 1, PWINDOW->m_vRealPosition.vec().y - BORDERSIZE - 1, PWINDOW->m_vRealSize.vec().x + 2 * BORDERSIZE + 2, PWINDOW->m_vRealSize.vec().y + 2 * BORDERSIZE + 2}; - + const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace; + wlr_box WLRBOXPREV = {0,0,0,0}; + if (PWINDOW) { + WLRBOXPREV = {(int)PWINDOW->m_vRealPosition.vec().x - BORDERSIZE - 1, (int)PWINDOW->m_vRealPosition.vec().y - BORDERSIZE - 1, (int)PWINDOW->m_vRealSize.vec().x + 2 * BORDERSIZE + 2, (int)PWINDOW->m_vRealSize.vec().y + 2 * BORDERSIZE + 2}; + } else if (PWORKSPACE) { + const auto PMONITOR = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID); + WLRBOXPREV = {(int)PMONITOR->vecPosition.x, (int)PMONITOR->vecPosition.y, (int)PMONITOR->vecSize.x, (int)PMONITOR->vecSize.y}; + } + // check if it's disabled, if so, warp if (av->m_pEnabled == 0 || animationsDisabled) { av->warp(); g_pHyprRenderer->damageBox(&WLRBOXPREV); - g_pHyprRenderer->damageWindow(PWINDOW); - // set size and pos if valid - if (g_pCompositor->windowValidMapped(PWINDOW)) - g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv()); + if (PWINDOW) { + g_pHyprRenderer->damageWindow(PWINDOW); + // set size and pos if valid + if (g_pCompositor->windowValidMapped(PWINDOW)) + g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv()); + } + continue; } @@ -125,10 +135,14 @@ void CAnimationManager::tick() { switch (av->m_eDamagePolicy) { case AVARDAMAGE_ENTIRE: { g_pHyprRenderer->damageBox(&WLRBOXPREV); - g_pHyprRenderer->damageWindow(PWINDOW); + + if (PWINDOW) + g_pHyprRenderer->damageWindow(PWINDOW); break; } case AVARDAMAGE_BORDER: { + RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!"); + // damage only the border. const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size") + 1; // +1 for padding and shit const auto ROUNDINGSIZE = g_pConfigManager->getInt("decoration:rounding") + 1; |
