From 033fc54c3c60510a45191bb1a6da93d9ce7a1d2c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 11 Jul 2025 19:06:23 +0200 Subject: [PATCH] scrolling: keep inner gap if there are windows to the side ref #421 --- hyprscrolling/Scrolling.cpp | 15 ++++++++------- hyprscrolling/Scrolling.hpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hyprscrolling/Scrolling.cpp b/hyprscrolling/Scrolling.cpp index eb10b74..6a9a366 100644 --- a/hyprscrolling/Scrolling.cpp +++ b/hyprscrolling/Scrolling.cpp @@ -242,7 +242,8 @@ void SWorkspaceData::recalculate(bool forceInstant) { double currentLeft = 0; const double cameraLeft = MAX_WIDTH < USABLE.w ? std::round((MAX_WIDTH - USABLE.w) / 2.0) : leftOffset; // layout pixels - for (const auto& COL : columns) { + for (size_t i = 0; i < columns.size(); ++i) { + const auto& COL = columns[i]; double currentTop = 0.0; const double ITEM_WIDTH = *PFSONONE && columns.size() == 1 ? USABLE.w : USABLE.w * COL->columnWidth; @@ -252,7 +253,7 @@ void SWorkspaceData::recalculate(bool forceInstant) { currentTop += WINDOW->windowSize * USABLE.h; - layout->applyNodeDataToWindow(WINDOW, forceInstant); + layout->applyNodeDataToWindow(WINDOW, forceInstant, i != columns.size() - 1, i != 0); } currentLeft += ITEM_WIDTH; @@ -291,7 +292,7 @@ bool SWorkspaceData::visible(SP c) { return false; } -void CScrollingLayout::applyNodeDataToWindow(SP data, bool force) { +void CScrollingLayout::applyNodeDataToWindow(SP data, bool force, bool hasWindowsRight, bool hasWindowsLeft) { PHLMONITOR PMONITOR; PHLWORKSPACE PWORKSPACE; @@ -314,8 +315,8 @@ void CScrollingLayout::applyNodeDataToWindow(SP data, bool } // for gaps outer - const bool DISPLAYLEFT = STICKS(data->layoutBox.x, PMONITOR->m_position.x + PMONITOR->m_reservedTopLeft.x); - const bool DISPLAYRIGHT = STICKS(data->layoutBox.x + data->layoutBox.w, PMONITOR->m_position.x + PMONITOR->m_size.x - PMONITOR->m_reservedBottomRight.x); + const bool DISPLAYLEFT = !hasWindowsLeft && STICKS(data->layoutBox.x, PMONITOR->m_position.x + PMONITOR->m_reservedTopLeft.x); + const bool DISPLAYRIGHT = !hasWindowsRight && STICKS(data->layoutBox.x + data->layoutBox.w, PMONITOR->m_position.x + PMONITOR->m_size.x - PMONITOR->m_reservedBottomRight.x); const bool DISPLAYTOP = STICKS(data->layoutBox.y, PMONITOR->m_position.y + PMONITOR->m_reservedTopLeft.y); const bool DISPLAYBOTTOM = STICKS(data->layoutBox.y + data->layoutBox.h, PMONITOR->m_position.y + PMONITOR->m_size.y - PMONITOR->m_reservedBottomRight.y); @@ -681,7 +682,7 @@ void CScrollingLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFull // if it got its fullscreen disabled, set back its node if it had one if (PNODE) - applyNodeDataToWindow(PNODE, false); + applyNodeDataToWindow(PNODE, false, false, false); else { // get back its' dimensions from position and size *pWindow->m_realPosition = pWindow->m_lastFloatingPosition; @@ -707,7 +708,7 @@ void CScrollingLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, const eFull fakeNode->ignoreFullscreenChecks = true; fakeNode->overrideWorkspace = pWindow->m_workspace; - applyNodeDataToWindow(fakeNode, false); + applyNodeDataToWindow(fakeNode, false, false, false); } } diff --git a/hyprscrolling/Scrolling.hpp b/hyprscrolling/Scrolling.hpp index bda3f23..8890ec9 100644 --- a/hyprscrolling/Scrolling.hpp +++ b/hyprscrolling/Scrolling.hpp @@ -113,7 +113,7 @@ class CScrollingLayout : public IHyprLayout { SP dataFor(PHLWINDOW w); SP currentWorkspaceData(); - void applyNodeDataToWindow(SP node, bool instant); + void applyNodeDataToWindow(SP node, bool instant, bool hasWindowsRight, bool hasWindowsLeft); friend struct SWorkspaceData; }; \ No newline at end of file