Skip to content

Commit 295f2d9

Browse files
committed
fix
1 parent 1b736d4 commit 295f2d9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/layout/IHyprLayout.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -500,17 +500,16 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
500500
const auto* EXTENTDIFF = *SNAPBORDEROVERLAP ? &EXTENTS : &EXTENTNONE;
501501
const auto MON = DRAGGINGWINDOW->m_monitor.lock();
502502

503-
const auto* GAPSOUT = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSOUT.ptr()->getData()) : &GAPSNONE;
504-
const auto RAW_WORK_AREA = MON->logicalBoxMinusReserved();
505-
const auto WORK_AREA = Desktop::CReservedArea{GAPSOUT->m_top, GAPSOUT->m_right, GAPSOUT->m_bottom, GAPSOUT->m_left}.apply(RAW_WORK_AREA);
503+
const auto* GAPSOUT = *SNAPRESPECTGAPS ? sc<CCssGapData*>(PGAPSOUT.ptr()->getData()) : &GAPSNONE;
504+
const auto WORK_AREA = Desktop::CReservedArea{GAPSOUT->m_top, GAPSOUT->m_right, GAPSOUT->m_bottom, GAPSOUT->m_left}.apply(MON->logicalBoxMinusReserved());
506505

507506
SRange monX = {WORK_AREA.x, WORK_AREA.x + WORK_AREA.w};
508507
SRange monY = {WORK_AREA.y, WORK_AREA.y + WORK_AREA.h};
509508

510-
const bool HAS_LEFT = RAW_WORK_AREA.x != MON->m_position.x;
511-
const bool HAS_TOP = RAW_WORK_AREA.y != MON->m_position.y;
512-
const bool HAS_BOTTOM = RAW_WORK_AREA.y + RAW_WORK_AREA.h != MON->m_position.y + MON->m_size.y;
513-
const bool HAS_RIGHT = RAW_WORK_AREA.x + RAW_WORK_AREA.w != MON->m_position.x + MON->m_size.y;
509+
const bool HAS_LEFT = MON->m_reservedArea.left() > 0;
510+
const bool HAS_TOP = MON->m_reservedArea.top() > 0;
511+
const bool HAS_BOTTOM = MON->m_reservedArea.bottom() > 0;
512+
const bool HAS_RIGHT = MON->m_reservedArea.right() > 0;
514513

515514
if (CORNER & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) &&
516515
((HAS_LEFT && canSnap(sourceX.start, monX.start, GAPSIZE)) || canSnap(sourceX.start, (monX.start -= MON->m_reservedArea.left() + EXTENTDIFF->topLeft.x), GAPSIZE))) {
@@ -528,8 +527,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
528527
snaps |= SNAP_UP;
529528
}
530529
if (CORNER & (CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT) &&
531-
((HAS_BOTTOM && canSnap(sourceY.end, monY.end, GAPSIZE)) ||
532-
canSnap(sourceY.end, (monY.end += MON->m_reservedArea.bottom() + EXTENTDIFF->bottomRight.y), GAPSIZE))) {
530+
((HAS_BOTTOM && canSnap(sourceY.end, monY.end, GAPSIZE)) || canSnap(sourceY.end, (monY.end += MON->m_reservedArea.bottom() + EXTENTDIFF->bottomRight.y), GAPSIZE))) {
533531
SNAP(sourceY.end, sourceY.start, monY.end);
534532
snaps |= SNAP_DOWN;
535533
}

0 commit comments

Comments
 (0)