Skip to content

Commit

Permalink
way better snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtherookie committed Aug 29, 2023
1 parent 468800c commit e4bc672
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,17 +964,22 @@ static inline void OnMotionNotify(XEvent e) {
if (snap) {
if (new_x < snap_threshold) {
new_x = 0;
}
else if (new_x > max_x - snap_threshold) {
} else if (new_x > max_x - snap_threshold && new_x < max_x + snap_threshold) {
new_x = max_x;
}

if (new_y < snap_threshold) {
if (new_y < snap_threshold + ((bar_position == top) ? (bar_size) : (0))) {
new_y = 0;
}

else if (new_y > max_y - snap_threshold) {
if (bar_position == top) {
new_y = bar_size;
}
} else if (new_y > max_y - ((bar_position == bottom) ? (bar_size) : (0)) - snap_threshold && new_y < max_y - ((bar_position == bottom) ? (bar_size) : (0)) + snap_threshold) {
new_y = max_y;

if (bar_position == bottom) {
new_y = max_y - bar_size;
}
}
}

Expand Down

0 comments on commit e4bc672

Please sign in to comment.