renderer/animations: Fix various inaccurate damage tracking issues and offsets (#5297)
This commit is contained in:
parent
1cc9a44318
commit
16a9c16d9f
15 changed files with 229 additions and 147 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ class CWindow {
|
|||
Vector2D m_vLastFloatingSize;
|
||||
Vector2D m_vLastFloatingPosition;
|
||||
|
||||
// for floating window offset in workspace animations
|
||||
Vector2D m_vFloatingOffset = Vector2D(0, 0);
|
||||
|
||||
// this is used for pseudotiling
|
||||
bool m_bIsPseudotiled = false;
|
||||
Vector2D m_vPseudoSize = Vector2D(0, 0);
|
||||
|
|
@ -421,6 +424,7 @@ class CWindow {
|
|||
void updateGroupOutputs();
|
||||
void switchWithWindowInGroup(CWindow* pWindow);
|
||||
void setAnimationsToMove();
|
||||
void onWorkspaceAnimUpdate();
|
||||
|
||||
private:
|
||||
// For hidden windows and stuff
|
||||
|
|
|
|||
|
|
@ -49,6 +49,16 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||
|
||||
// set floating windows offset callbacks
|
||||
m_vRenderOffset.setUpdateCallback([&](void*) {
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
if (!g_pCompositor->windowValidMapped(w.get()) || w->m_iWorkspaceID != m_iID)
|
||||
continue;
|
||||
|
||||
w->onWorkspaceAnimUpdate();
|
||||
};
|
||||
});
|
||||
|
||||
if (ANIMSTYLE.starts_with("slidefade")) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
float movePerc = 100.f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue