summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorend-4 <97237370+end-4@users.noreply.github.com>2023-08-18 03:30:20 +0700
committerGitHub <noreply@github.com>2023-08-17 22:30:20 +0200
commit37a211a2ae94abad0f606433a58603e70261d0bb (patch)
tree7b3ba96fe4257489eb5be38de95832859848dbe5 /src/managers
parent7155b4c26606d7681bacb2517b1d19495336c6c3 (diff)
animations: add slidefade and slidefadevert styles for workspaces (#3008)
* add slidefade and slidefadevert animations * fix swiping for slidefadevert * rename minPerc to movePerc for slidefade anim styles * change default slidefade percentage to 100% * remove useless comments * findlastof + 1 * debug logging for slidefade/slidefadevert percentage
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/AnimationManager.cpp16
-rw-r--r--src/managers/input/Swipe.cpp6
2 files changed, 20 insertions, 2 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 3cd0d065..f4e845c3 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -485,6 +485,22 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
} else if (config == "workspaces" || config == "specialWorkspace") {
if (style == "slide" || style == "slidevert" || style == "fade")
return "";
+ else if (style.find("slidefade") == 0) {
+ // try parsing
+ float movePerc = 0.f;
+ if (style.find("%") != std::string::npos) {
+ try {
+ auto percstr = style.substr(style.find_last_of(' ') + 1);
+ movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
+ } catch (std::exception& e) { return "invalid movePerc"; }
+
+ return "";
+ }
+
+ movePerc; // fix warning
+
+ return "";
+ }
return "unknown style";
} else if (config == "borderangle") {
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index 906d5d9b..5fe91b65 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -50,7 +50,8 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
static auto* const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue;
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue;
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
- const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert";
+ const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
+ m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.find("slidefadevert") == 0;
// commit
std::string wsname = "";
@@ -194,7 +195,8 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue;
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
- const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert";
+ const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
+ m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.find("slidefadevert") == 0;
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx);