diff options
| author | Mike Will <myQwil@gmail.com> | 2025-06-27 06:01:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-27 12:01:45 +0200 |
| commit | b850b35778de09079d6e20256f9cf79ba6a9f0db (patch) | |
| tree | 411949e3cfd0391e2973eacf53254ed6906c7ead /src/layout/IHyprLayout.cpp | |
| parent | 2796ec1cf2c63b44c7cdd7a641d7a2c6e158f279 (diff) | |
snap: move `gapOffset` logic outside of for loop (#10861)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 40794b3e..6bc82516 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -439,6 +439,13 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA const auto WSID = DRAGGINGWINDOW->workspaceID(); const bool HASFULLSCREEN = DRAGGINGWINDOW->m_workspace && DRAGGINGWINDOW->m_workspace->m_hasFullscreenWindow; + double gapOffset = 0; + if (*SNAPRESPECTGAPS) { + static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in"); + auto* PGAPSINPTR = (CCssGapData*)(PGAPSINDATA.ptr())->getData(); + gapOffset = std::max({PGAPSINPTR->m_left, PGAPSINPTR->m_right, PGAPSINPTR->m_top, PGAPSINPTR->m_bottom}); + } + for (auto& other : g_pCompositor->m_windows) { if ((HASFULLSCREEN && !other->m_createdOverFullscreen) || other == DRAGGINGWINDOW || other->workspaceID() != WSID || !other->m_isMapped || other->m_fadingOut || other->isX11OverrideRedirect()) @@ -447,13 +454,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA const int OTHERBORDERSIZE = other->getRealBorderSize(); const double BORDERSIZE = OVERLAP ? std::max(DRAGGINGBORDERSIZE, OTHERBORDERSIZE) : (DRAGGINGBORDERSIZE + OTHERBORDERSIZE); - const CBox SURF = other->getWindowMainSurfaceBox(); - double gapOffset = 0; - if (*SNAPRESPECTGAPS) { - static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in"); - auto* PGAPSINPTR = (CCssGapData*)(PGAPSINDATA.ptr())->getData(); - gapOffset = std::max({PGAPSINPTR->m_left, PGAPSINPTR->m_right, PGAPSINPTR->m_top, PGAPSINPTR->m_bottom}); - } + const CBox SURF = other->getWindowMainSurfaceBox(); const SRange SURFBX = {SURF.x - BORDERSIZE - gapOffset, SURF.x + SURF.w + BORDERSIZE + gapOffset}; const SRange SURFBY = {SURF.y - BORDERSIZE - gapOffset, SURF.y + SURF.h + BORDERSIZE + gapOffset}; |
