mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 03:29:48 +01:00
snap: use the bit mask to check if snapping occurred (#8659)
This commit is contained in:
parent
cccca7c02e
commit
5ff02902ee
1 changed files with 2 additions and 2 deletions
|
@ -455,7 +455,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
|
||||||
|
|
||||||
// corner snapping
|
// corner snapping
|
||||||
const double BORDERDIFF = OTHERBORDERSIZE - DRAGGINGBORDERSIZE;
|
const double BORDERDIFF = OTHERBORDERSIZE - DRAGGINGBORDERSIZE;
|
||||||
if (sourceX.start == SURFBX.end || SURFBX.start == sourceX.end) {
|
if (snaps & (SNAP_LEFT | SNAP_RIGHT)) {
|
||||||
const SRange SURFY = {SURF.y - BORDERDIFF, SURF.y + SURF.h + BORDERDIFF};
|
const SRange SURFY = {SURF.y - BORDERDIFF, SURF.y + SURF.h + BORDERDIFF};
|
||||||
if (CORNER & (CORNER_TOPLEFT | CORNER_TOPRIGHT) && canSnap(sourceY.start, SURFY.start, GAPSIZE)) {
|
if (CORNER & (CORNER_TOPLEFT | CORNER_TOPRIGHT) && canSnap(sourceY.start, SURFY.start, GAPSIZE)) {
|
||||||
SNAP(sourceY.start, sourceY.end, SURFY.start);
|
SNAP(sourceY.start, sourceY.end, SURFY.start);
|
||||||
|
@ -465,7 +465,7 @@ static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRA
|
||||||
snaps |= SNAP_DOWN;
|
snaps |= SNAP_DOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sourceY.start == SURFBY.end || SURFBY.start == sourceY.end) {
|
if (snaps & (SNAP_UP | SNAP_DOWN)) {
|
||||||
const SRange SURFX = {SURF.x - BORDERDIFF, SURF.x + SURF.w + BORDERDIFF};
|
const SRange SURFX = {SURF.x - BORDERDIFF, SURF.x + SURF.w + BORDERDIFF};
|
||||||
if (CORNER & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) && canSnap(sourceX.start, SURFX.start, GAPSIZE)) {
|
if (CORNER & (CORNER_TOPLEFT | CORNER_BOTTOMLEFT) && canSnap(sourceX.start, SURFX.start, GAPSIZE)) {
|
||||||
SNAP(sourceX.start, sourceX.end, SURFX.start);
|
SNAP(sourceX.start, sourceX.end, SURFX.start);
|
||||||
|
|
Loading…
Reference in a new issue