aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-08-24 20:54:05 +0200
committerVaxry <[email protected]>2024-08-24 20:54:05 +0200
commitd3e26652d627a7bf3e562de415568260d9865a2f (patch)
tree4edc2e615f67410adc77a3f48bebad92b104e665
parent276652b44e43a441381f51644f21ed901dab6c8f (diff)
downloadHyprland-d3e26652d627a7bf3e562de415568260d9865a2f.tar.gz
Hyprland-d3e26652d627a7bf3e562de415568260d9865a2f.zip
better
-rw-r--r--src/desktop/Workspace.cpp85
1 files changed, 42 insertions, 43 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 735da9f7..5c1fedf1 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -114,58 +114,57 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
m_fAlpha = in ? 1.F : 0.F;
// handle animation styles for the movement one
- if (ANIMSTYLE.starts_with("slide") && ANIMSTYLE.contains("%")) {
- const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
- float movePerc = 0.F;
+ if (m_vRenderOffset.m_pConfig->pValues->internalEnabled) {
+ if (ANIMSTYLE.starts_with("slide") && ANIMSTYLE.contains("%")) {
+ const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
+ float movePerc = 0.F;
- try {
- auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
- movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
- } catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
+ try {
+ auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
+ movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
+ } catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
- m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
- m_fScaleClients.setValueAndWarp(1.F);
-
- if (ANIMSTYLE.starts_with("slidevert")) {
- if (in) {
- m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
- m_vRenderOffset = Vector2D(0, 0);
- } else
- m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
+ m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
+ m_fScaleClients.setValueAndWarp(1.F);
- } else {
- if (in) {
- m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
- m_vRenderOffset = Vector2D(0, 0);
- } else
- m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
- }
- } else if (ANIMSTYLE.starts_with("popin")) {
- m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
+ if (ANIMSTYLE.starts_with("slidevert")) {
+ if (in) {
+ m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
+ m_vRenderOffset = Vector2D(0, 0);
+ } else
+ m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
+
+ } else {
+ if (in) {
+ m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
+ m_vRenderOffset = Vector2D(0, 0);
+ } else
+ m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
+ }
+ } else if (ANIMSTYLE.starts_with("popin")) {
+ m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
- float startPerc = 0.F;
+ float startPerc = 0.F;
- try {
- auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
- startPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
- } catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
+ try {
+ auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
+ startPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
+ } catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
- if (in) {
- m_fScaleClients.setValueAndWarp(startPerc / 100.F);
- m_fScaleClients = 1.F;
+ if (in) {
+ m_fScaleClients.setValueAndWarp(startPerc / 100.F);
+ m_fScaleClients = 1.F;
+ } else {
+ m_fScaleClients.setValueAndWarp(1.F);
+ m_fScaleClients = startPerc / 100.F;
+ }
} else {
- m_fScaleClients.setValueAndWarp(1.F);
- m_fScaleClients = startPerc / 100.F;
- }
- } else {
- // fallback is slide
- const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
- const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
+ // fallback is slide
+ const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
+ const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
- m_fScaleClients.setValueAndWarp(1.F);
+ m_fScaleClients.setValueAndWarp(1.F);
- // special case: fade enabled but this anim is disabled, so don't change anything. Only do the anim otherwise.
- if (m_vRenderOffset.m_pConfig->pValues->internalEnabled || !m_fAlpha.m_pConfig->pValues->internalEnabled) {
if (in) {
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
m_vRenderOffset = Vector2D(0, 0);