summaryrefslogtreecommitdiff
path: root/src/desktop/Window.cpp
diff options
context:
space:
mode:
authorthejch <66577496+thejch@users.noreply.github.com>2024-03-30 18:14:26 -0700
committerGitHub <noreply@github.com>2024-03-31 02:14:26 +0100
commit16a9c16d9f99bd8be9f1bb15442b001fdf2ea759 (patch)
treef9cb60dc2d92519079699e9cb6e71e562b55a8a5 /src/desktop/Window.cpp
parent1cc9a44318e53a34f41cc36483502de985b88cf8 (diff)
renderer/animations: Fix various inaccurate damage tracking issues and offsets (#5297)
Diffstat (limited to 'src/desktop/Window.cpp')
-rw-r--r--src/desktop/Window.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 1336456a..891fd652 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -1165,6 +1165,44 @@ void CWindow::setAnimationsToMove() {
m_bAnimatingIn = false;
}
+void CWindow::onWorkspaceAnimUpdate() {
+ // clip box for animated offsets
+ if (!m_bIsFloating || m_bPinned || m_bIsFullscreen) {
+ m_vFloatingOffset = Vector2D(0, 0);
+ return;
+ }
+
+ Vector2D offset;
+ const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
+ if (!PWORKSPACE)
+ return;
+
+ const auto PWSMON = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
+ if (!PWSMON)
+ return;
+
+ const auto WINBB = getFullWindowBoundingBox();
+ if (PWORKSPACE->m_vRenderOffset.value().x != 0) {
+ const auto PROGRESS = PWORKSPACE->m_vRenderOffset.value().x / PWSMON->vecSize.x;
+
+ if (WINBB.x < PWSMON->vecPosition.x)
+ offset.x += (PWSMON->vecPosition.x - WINBB.x) * PROGRESS;
+
+ if (WINBB.x + WINBB.width > PWSMON->vecPosition.x + PWSMON->vecSize.x)
+ offset.x += (WINBB.x + WINBB.width - PWSMON->vecPosition.x - PWSMON->vecSize.x) * PROGRESS;
+ } else if (PWORKSPACE->m_vRenderOffset.value().y != 0) {
+ const auto PROGRESS = PWORKSPACE->m_vRenderOffset.value().y / PWSMON->vecSize.y;
+
+ if (WINBB.y < PWSMON->vecPosition.y)
+ offset.y += (PWSMON->vecPosition.y - WINBB.y) * PROGRESS;
+
+ if (WINBB.y + WINBB.height > PWSMON->vecPosition.y + PWSMON->vecSize.y)
+ offset.y += (WINBB.y + WINBB.height - PWSMON->vecPosition.y - PWSMON->vecSize.y) * PROGRESS;
+ }
+
+ m_vFloatingOffset = offset;
+}
+
int CWindow::popupsCount() {
if (m_bIsX11)
return 1;