about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-05-19 13:41:58 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-05-19 13:41:58 +0100
commit71365a524f67235024de7db277c63f8ac4f46569 (patch)
tree1ef789d08b9f3cd2f552b916d8fab5cdc85076f3
parent3afca3e6a1457e93c9f7803dfcbc31f86b413095 (diff)
downloaddwm-71365a524f67235024de7db277c63f8ac4f46569.tar.gz
only snap within window area
-rw-r--r--dwm.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/dwm.c b/dwm.c
index 364d65b..504b78b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1039,16 +1039,19 @@ movemouse(Client *c) {
 			XSync(dpy, False);
 			nx = ocx + (ev.xmotion.x - x1);
 			ny = ocy + (ev.xmotion.y - y1);
-			if(abs(wx - nx) < snap)
-				nx = wx;
-			else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
-				nx = wx + ww - c->w - 2 * c->bw;
-			if(abs(wy - ny) < snap)
-				ny = wy;
-			else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
-				ny = wy + wh - c->h - 2 * c->bw;
-			if(!c->isfloating && lt->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
-				togglefloating(NULL);
+			if(snap && nx >= wx && nx <= wx + ww
+			        && ny >= wy && ny <= wy + wh) {
+				if(abs(wx - nx) < snap)
+					nx = wx;
+				else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
+					nx = wx + ww - c->w - 2 * c->bw;
+				if(abs(wy - ny) < snap)
+					ny = wy;
+				else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap)
+					ny = wy + wh - c->h - 2 * c->bw;
+				if(!c->isfloating && lt->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
+					togglefloating(NULL);
+			}
 			if(!lt->arrange || c->isfloating)
 				resize(c, nx, ny, c->w, c->h, False);
 			break;
@@ -1193,8 +1196,12 @@ resizemouse(Client *c) {
 			XSync(dpy, False);
 			nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
 			nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
-			if(!c->isfloating && lt->arrange && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) {
-				togglefloating(NULL);
+
+			if(snap && nw >= wx && nw <= wx + ww
+			        && nh >= wy && nh <= wy + wh) {
+				if(!c->isfloating && lt->arrange
+				   && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
+					togglefloating(NULL);
 			}
 			if(!lt->arrange || c->isfloating)
 				resize(c, c->x, c->y, nw, nh, True);
-02 17:49:21 +0200 implemented the idea presented by Sander for dwm target' href='/acidbong/suckless/dwm/commit/Makefile?h=4.2&id=5d3fd3707b262508d1750cf95ac2e2f666be6163'>5d3fd37 ^
a2d56f6 ^
99b126d ^

1076f2b
650a1fb ^
1076f2b
95766d6 ^
82064af ^
1076f2b

4d55eee ^
db876f9 ^
dbf7e03 ^

4d55eee ^






dbf7e03 ^

4d55eee ^
dbf7e03 ^
4d55eee ^


dbf7e03 ^
d9386a0 ^
4d55eee ^
dbf7e03 ^

4d55eee ^



dc5c070 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62