@@ -422,14 +422,14 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
422
422
const double BORDERSIZE = OVERLAP ? std::max (DRAGGINGBORDERSIZE, OTHERBORDERSIZE) : (DRAGGINGBORDERSIZE + OTHERBORDERSIZE);
423
423
424
424
const CBox SURF = other->getWindowMainSurfaceBox ();
425
- double GAP_OFFSET = 0 ;
425
+ double gapOffset = 0 ;
426
426
if (*SNAPRESPECTGAPS) {
427
427
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>(" general:gaps_in" );
428
428
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 });
430
430
}
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 };
433
433
434
434
// only snap windows if their ranges overlap in the opposite axis
435
435
if (sourceY.start <= SURFBY.end && SURFBY.start <= sourceY.end ) {
@@ -480,35 +480,35 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
480
480
const double GAPSIZE = *SNAPMONITORGAP;
481
481
const double BORDERDIFF = OVERLAP ? DRAGGINGBORDERSIZE : 0 ;
482
482
const auto MON = DRAGGINGWINDOW->m_monitor .lock ();
483
- double GAP_OFFSET = 0 ;
483
+ double gapOffset = 0 ;
484
484
if (*SNAPRESPECTGAPS) {
485
485
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>(" general:gaps_out" );
486
486
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 });
488
488
}
489
489
490
490
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 );
494
494
snaps |= SNAP_LEFT;
495
495
}
496
496
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 );
500
500
snaps |= SNAP_RIGHT;
501
501
}
502
502
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 );
506
506
snaps |= SNAP_UP;
507
507
}
508
508
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 );
512
512
snaps |= SNAP_DOWN;
513
513
}
514
514
}
0 commit comments