summaryrefslogtreecommitdiff
path: root/src/managers/input/Swipe.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2022-09-19 10:23:13 +0100
committervaxerski <vaxry@vaxry.net>2022-09-19 10:23:13 +0100
commit7c809a3059388b8fdbb3de4aca68656c01162f4f (patch)
tree1b1a568396d47ebb4234cacc77ccf86cb831ec3c /src/managers/input/Swipe.cpp
parent4070e1a148663962ba8f2eff4eeaf018fe6d863b (diff)
fullscreen animation en-nice-ment
Diffstat (limited to 'src/managers/input/Swipe.cpp')
-rw-r--r--src/managers/input/Swipe.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index 30303680..165068b4 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -27,6 +27,12 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
m_sActiveSwipe.pMonitor = g_pCompositor->m_pLastMonitor;
m_sActiveSwipe.avgSpeed = 0;
m_sActiveSwipe.speedPoints = 0;
+
+ if (PWORKSPACE->m_bHasFullscreenWindow) {
+ for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
+ ls->alpha = 255.f;
+ }
+ }
}
void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
@@ -47,6 +53,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec();
+ CWorkspace* pSwitchedTo = nullptr;
+
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) || abs(m_sActiveSwipe.delta) < 2) {
// revert
if (abs(m_sActiveSwipe.delta) < 2) {
@@ -64,6 +72,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
}
+
+ pSwitchedTo = m_sActiveSwipe.pWorkspaceBegin;
} else if (m_sActiveSwipe.delta < 0) {
// switch to left
const auto RENDEROFFSET = PWORKSPACEL->m_vRenderOffset.vec();
@@ -80,6 +90,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
g_pInputManager->unconstrainMouse();
Debug::log(LOG, "Ended swipe to the left");
+
+ pSwitchedTo = PWORKSPACEL;
} else {
// switch to right
const auto RENDEROFFSET = PWORKSPACER->m_vRenderOffset.vec();
@@ -96,6 +108,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
g_pInputManager->unconstrainMouse();
Debug::log(LOG, "Ended swipe to the right");
+
+ pSwitchedTo = PWORKSPACER;
}
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
@@ -107,6 +121,11 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
m_sActiveSwipe.pWorkspaceBegin = nullptr;
g_pInputManager->refocus();
+
+ // apply alpha
+ for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
+ ls->alpha = pSwitchedTo->m_bHasFullscreenWindow ? 0.f : 255.f;
+ }
}
void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {