mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 01:49:50 +01:00
animations: Fix animation issue in focusworkspaceoncurrentmonitor (#5202)
* dont render when workspace offset
* add guard
* can remove useless code now if workspace offset is not taken into account
* clang-format
* when special workspace is moved, set anim to move
* add offset back
* make it a configurable option because some folks apparently can't align their monitors correctly and may not want this feature😔
* remove config option
This commit is contained in:
parent
295128ab2a
commit
c7fbea3368
3 changed files with 11 additions and 8 deletions
|
@ -667,6 +667,7 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
|
|||
if (w->m_iWorkspaceID == pWorkspace->m_iID) {
|
||||
w->m_iMonitorID = ID;
|
||||
w->updateSurfaceScaleTransformDetails();
|
||||
w->setAnimationsToMove();
|
||||
|
||||
const auto MIDDLE = w->middle();
|
||||
if (w->m_bIsFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && w->m_iX11Type != 2) {
|
||||
|
|
|
@ -109,14 +109,13 @@ void CAnimationManager::tick() {
|
|||
g_pHyprRenderer->damageWindow(w.get());
|
||||
}
|
||||
|
||||
// if a workspace window is on any monitor, damage it
|
||||
// if a special workspace window is on any monitor, damage it
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
if (w->m_iWorkspaceID == PWORKSPACE->m_iID && g_pCompositor->windowValidMapped(w.get()) && g_pHyprRenderer->shouldRenderWindow(w.get(), m.get(), PWORKSPACE)) {
|
||||
if (w->m_iWorkspaceID == PWORKSPACE->m_iID && PWORKSPACE->m_bIsSpecialWorkspace && g_pCompositor->windowValidMapped(w.get()) &&
|
||||
g_pHyprRenderer->shouldRenderWindow(w.get(), m.get(), PWORKSPACE)) {
|
||||
CBox bb = w->getFullWindowBoundingBox();
|
||||
bb.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||
bb.scaleFromCenter(1.1); // for some reason special ws windows getting border artifacts if you close it too quickly...
|
||||
bb.intersection({m->vecPosition, m->vecSize});
|
||||
g_pHyprRenderer->damageBox(&bb);
|
||||
}
|
||||
|
@ -197,7 +196,8 @@ void CAnimationManager::tick() {
|
|||
PWINDOW->updateWindowDecos();
|
||||
auto bb = PWINDOW->getFullWindowBoundingBox();
|
||||
const auto PWINDOWWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
bb.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
if (PWINDOWWORKSPACE)
|
||||
bb.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
g_pHyprRenderer->damageBox(&bb);
|
||||
} else if (PWORKSPACE) {
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
|
@ -245,7 +245,7 @@ void CAnimationManager::tick() {
|
|||
BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||
|
||||
// damage for new box
|
||||
CBox WLRBOXNEW = {PWINDOW->m_vRealPosition.value(), PWINDOW->m_vRealSize.value()};
|
||||
CBox WLRBOXNEW = PWINDOW->getFullWindowBoundingBox();
|
||||
const auto PWINDOWWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
if (PWINDOWWORKSPACE)
|
||||
WLRBOXNEW.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||
|
|
|
@ -217,7 +217,7 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor, CWo
|
|||
}
|
||||
}
|
||||
|
||||
if (pWindow->m_iWorkspaceID == pWorkspace->m_iID)
|
||||
if (pWindow->m_iWorkspaceID == pWorkspace->m_iID && pWorkspace->m_iMonitorID == pMonitor->ID)
|
||||
return true;
|
||||
|
||||
// if not, check if it maybe is active on a different monitor.
|
||||
|
@ -228,9 +228,11 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor, CWo
|
|||
return true;
|
||||
|
||||
if (pWindow->m_vRealPosition.isBeingAnimated()) {
|
||||
if (PWINDOWWORKSPACE && !PWINDOWWORKSPACE->m_bIsSpecialWorkspace && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated())
|
||||
return false;
|
||||
// render window if window and monitor intersect
|
||||
// (when moving out of or through a monitor)
|
||||
CBox windowBox = {pWindow->m_vRealPosition.value(), pWindow->m_vRealSize.value()};
|
||||
CBox windowBox = pWindow->getFullWindowBoundingBox();
|
||||
const CBox monitorBox = {pMonitor->vecPosition, pMonitor->vecSize};
|
||||
if (!windowBox.intersection(monitorBox).empty())
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue