# HG changeset patch # User arg@mig29 # Date 1162205885 -3600 # Node ID 798b906378d6943cb17ef828916440e3a1499cc4 # Parent 787f6ae02f29119fa97d3ee669b5f9c9aeb0df61 added screen-border snapping in floating mode, feels quite well diff -r 787f6ae02f29 -r 798b906378d6 config.arg.h --- a/config.arg.h Fri Oct 27 13:29:35 2006 +0200 +++ b/config.arg.h Mon Oct 30 11:58:05 2006 +0100 @@ -19,6 +19,7 @@ #define MASTER 600 /* per thousand */ #define MODKEY Mod1Mask +#define SNAP 20 /* pixel */ #define KEYS \ static Key key[] = { \ diff -r 787f6ae02f29 -r 798b906378d6 config.default.h --- a/config.default.h Fri Oct 27 13:29:35 2006 +0200 +++ b/config.default.h Mon Oct 30 11:58:05 2006 +0100 @@ -19,6 +19,7 @@ #define MASTER 600 /* per thousand */ #define MODKEY Mod1Mask +#define SNAP 20 /* pixel */ #define KEYS \ static Key key[] = { \ diff -r 787f6ae02f29 -r 798b906378d6 event.c --- a/event.c Fri Oct 27 13:29:35 2006 +0200 +++ b/event.c Mon Oct 30 11:58:05 2006 +0100 @@ -48,6 +48,14 @@ XSync(dpy, False); c->x = ocx + (ev.xmotion.x - x1); c->y = ocy + (ev.xmotion.y - y1); + if(abs(c->x) < sx + SNAP) + c->x = sx; + if(abs(c->y) < sy + bh + SNAP) + c->y = sy + bh; + if(abs(c->x + c->w) > sx + sw - SNAP) + c->x = sw - c->w - 2 * BORDERPX; + if(abs(c->y + c->h) > sy + sh - SNAP) + c->y = sh - c->h - 2 * BORDERPX; resize(c, False, TopLeft); break; }