summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarg@mig29 <unknown>2006-10-30 11:58:05 +0100
committerarg@mig29 <unknown>2006-10-30 11:58:05 +0100
commitb6614261ea48c9711cefd79601e09fa764ee3075 (patch)
treee45411abe4b58a8acea5e7f5d1a0b9b4ea855a06
parentand another fix (diff)
downloaddwm-b6614261ea48c9711cefd79601e09fa764ee3075.tar.gz
dwm-b6614261ea48c9711cefd79601e09fa764ee3075.zip
added screen-border snapping in floating mode, feels quite well
-rw-r--r--config.arg.h1
-rw-r--r--config.default.h1
-rw-r--r--event.c8
3 files changed, 10 insertions, 0 deletions
diff --git a/config.arg.h b/config.arg.h
index 84f37a7..30bfaf9 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -19,6 +19,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
19 19
20#define MASTER 600 /* per thousand */ 20#define MASTER 600 /* per thousand */
21#define MODKEY Mod1Mask 21#define MODKEY Mod1Mask
22#define SNAP 20 /* pixel */
22 23
23#define KEYS \ 24#define KEYS \
24static Key key[] = { \ 25static Key key[] = { \
diff --git a/config.default.h b/config.default.h
index fb452f2..0a595a2 100644
--- a/config.default.h
+++ b/config.default.h
@@ -19,6 +19,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
19 19
20#define MASTER 600 /* per thousand */ 20#define MASTER 600 /* per thousand */
21#define MODKEY Mod1Mask 21#define MODKEY Mod1Mask
22#define SNAP 20 /* pixel */
22 23
23#define KEYS \ 24#define KEYS \
24static Key key[] = { \ 25static Key key[] = { \
diff --git a/event.c b/event.c
index bf88819..d0f446f 100644
--- a/event.c
+++ b/event.c
@@ -48,6 +48,14 @@ movemouse(Client *c) {
48 XSync(dpy, False); 48 XSync(dpy, False);
49 c->x = ocx + (ev.xmotion.x - x1); 49 c->x = ocx + (ev.xmotion.x - x1);
50 c->y = ocy + (ev.xmotion.y - y1); 50 c->y = ocy + (ev.xmotion.y - y1);
51 if(abs(c->x) < sx + SNAP)
52 c->x = sx;
53 if(abs(c->y) < sy + bh + SNAP)
54 c->y = sy + bh;
55 if(abs(c->x + c->w) > sx + sw - SNAP)
56 c->x = sw - c->w - 2 * BORDERPX;
57 if(abs(c->y + c->h) > sy + sh - SNAP)
58 c->y = sh - c->h - 2 * BORDERPX;
51 resize(c, False, TopLeft); 59 resize(c, False, TopLeft);
52 break; 60 break;
53 } 61 }