Skip to content

Commit 39ce508

Browse files
style
1 parent 998500b commit 39ce508

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/layout/IHyprLayout.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,14 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
422422
const double BORDERSIZE = OVERLAP ? std::max(DRAGGINGBORDERSIZE, OTHERBORDERSIZE) : (DRAGGINGBORDERSIZE + OTHERBORDERSIZE);
423423

424424
const CBox SURF = other->getWindowMainSurfaceBox();
425-
double GAP_OFFSET = 0;
425+
double gapOffset = 0;
426426
if (*SNAPRESPECTGAPS) {
427427
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
428428
auto* PGAPSINPTR = (CCssGapData*)(PGAPSINDATA.ptr())->getData();
429-
GAP_OFFSET = std::max({PGAPSINPTR->m_left, PGAPSINPTR->m_right, PGAPSINPTR->m_top, PGAPSINPTR->m_bottom});
429+
gapOffset = std::max({PGAPSINPTR->m_left, PGAPSINPTR->m_right, PGAPSINPTR->m_top, PGAPSINPTR->m_bottom});
430430
}
431-
const SRange SURFBX = {SURF.x - BORDERSIZE - GAP_OFFSET, SURF.x + SURF.w + BORDERSIZE + GAP_OFFSET};
432-
const SRange SURFBY = {SURF.y - BORDERSIZE - GAP_OFFSET, SURF.y + SURF.h + BORDERSIZE + GAP_OFFSET};
431+
const SRange SURFBX = {SURF.x - BORDERSIZE - gapOffset, SURF.x + SURF.w + BORDERSIZE + gapOffset};
432+
const SRange SURFBY = {SURF.y - BORDERSIZE - gapOffset, SURF.y + SURF.h + BORDERSIZE + gapOffset};
433433

434434
// only snap windows if their ranges overlap in the opposite axis
435435
if (sourceY.start <= SURFBY.end && SURFBY.start <= sourceY.end) {
@@ -480,35 +480,35 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
480480
const double GAPSIZE = *SNAPMONITORGAP;
481481
const double BORDERDIFF = OVERLAP ? DRAGGINGBORDERSIZE : 0;
482482
const auto MON = DRAGGINGWINDOW->m_monitor.lock();
483-
double GAP_OFFSET = 0;
483+
double gapOffset = 0;
484484
if (*SNAPRESPECTGAPS) {
485485
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
486486
auto* PGAPSOUTPTR = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
487-
GAP_OFFSET = std::max({PGAPSOUTPTR->m_left, PGAPSOUTPTR->m_right, PGAPSOUTPTR->m_top, PGAPSOUTPTR->m_bottom});
487+
gapOffset = std::max({PGAPSOUTPTR->m_left, PGAPSOUTPTR->m_right, PGAPSOUTPTR->m_top, PGAPSOUTPTR->m_bottom});
488488
}
489489

490490
if (CORNER & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) &&
491-
((MON->m_reservedTopLeft.x > 0 && canSnap(sourceX.start, MON->m_position.x + MON->m_reservedTopLeft.x + DRAGGINGBORDERSIZE + GAP_OFFSET, GAPSIZE)) ||
492-
canSnap(sourceX.start, MON->m_position.x + MON->m_reservedTopLeft.x - BORDERDIFF + GAP_OFFSET, GAPSIZE))) {
493-
SNAP(sourceX.start, sourceX.end, MON->m_position.x + MON->m_reservedTopLeft.x + DRAGGINGBORDERSIZE + GAP_OFFSET);
491+
((MON->m_reservedTopLeft.x > 0 && canSnap(sourceX.start, MON->m_position.x + MON->m_reservedTopLeft.x + DRAGGINGBORDERSIZE + gapOffset, GAPSIZE)) ||
492+
canSnap(sourceX.start, MON->m_position.x + MON->m_reservedTopLeft.x - BORDERDIFF + gapOffset, GAPSIZE))) {
493+
SNAP(sourceX.start, sourceX.end, MON->m_position.x + MON->m_reservedTopLeft.x + DRAGGINGBORDERSIZE + gapOffset);
494494
snaps |= SNAP_LEFT;
495495
}
496496
if (CORNER & (CORNER_TOPRIGHT | CORNER_BOTTOMRIGHT) &&
497-
((MON->m_reservedBottomRight.x > 0 && canSnap(sourceX.end, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x - DRAGGINGBORDERSIZE - GAP_OFFSET, GAPSIZE)) ||
498-
canSnap(sourceX.end, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x + BORDERDIFF - GAP_OFFSET, GAPSIZE))) {
499-
SNAP(sourceX.end, sourceX.start, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x - DRAGGINGBORDERSIZE - GAP_OFFSET);
497+
((MON->m_reservedBottomRight.x > 0 && canSnap(sourceX.end, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x - DRAGGINGBORDERSIZE - gapOffset, GAPSIZE)) ||
498+
canSnap(sourceX.end, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x + BORDERDIFF - gapOffset, GAPSIZE))) {
499+
SNAP(sourceX.end, sourceX.start, MON->m_position.x + MON->m_size.x - MON->m_reservedBottomRight.x - DRAGGINGBORDERSIZE - gapOffset);
500500
snaps |= SNAP_RIGHT;
501501
}
502502
if (CORNER & (CORNER_TOPLEFT | CORNER_TOPRIGHT) &&
503-
((MON->m_reservedTopLeft.y > 0 && canSnap(sourceY.start, MON->m_position.y + MON->m_reservedTopLeft.y + DRAGGINGBORDERSIZE + GAP_OFFSET, GAPSIZE)) ||
504-
canSnap(sourceY.start, MON->m_position.y + MON->m_reservedTopLeft.y - BORDERDIFF + GAP_OFFSET, GAPSIZE))) {
505-
SNAP(sourceY.start, sourceY.end, MON->m_position.y + MON->m_reservedTopLeft.y + DRAGGINGBORDERSIZE + GAP_OFFSET);
503+
((MON->m_reservedTopLeft.y > 0 && canSnap(sourceY.start, MON->m_position.y + MON->m_reservedTopLeft.y + DRAGGINGBORDERSIZE + gapOffset, GAPSIZE)) ||
504+
canSnap(sourceY.start, MON->m_position.y + MON->m_reservedTopLeft.y - BORDERDIFF + gapOffset, GAPSIZE))) {
505+
SNAP(sourceY.start, sourceY.end, MON->m_position.y + MON->m_reservedTopLeft.y + DRAGGINGBORDERSIZE + gapOffset);
506506
snaps |= SNAP_UP;
507507
}
508508
if (CORNER & (CORNER_BOTTOMLEFT | CORNER_BOTTOMRIGHT) &&
509-
((MON->m_reservedBottomRight.y > 0 && canSnap(sourceY.end, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y - DRAGGINGBORDERSIZE - GAP_OFFSET, GAPSIZE)) ||
510-
canSnap(sourceY.end, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y + BORDERDIFF - GAP_OFFSET, GAPSIZE))) {
511-
SNAP(sourceY.end, sourceY.start, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y - DRAGGINGBORDERSIZE - GAP_OFFSET);
509+
((MON->m_reservedBottomRight.y > 0 && canSnap(sourceY.end, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y - DRAGGINGBORDERSIZE - gapOffset, GAPSIZE)) ||
510+
canSnap(sourceY.end, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y + BORDERDIFF - gapOffset, GAPSIZE))) {
511+
SNAP(sourceY.end, sourceY.start, MON->m_position.y + MON->m_size.y - MON->m_reservedBottomRight.y - DRAGGINGBORDERSIZE - gapOffset);
512512
snaps |= SNAP_DOWN;
513513
}
514514
}

0 commit comments

Comments
 (0)