only snap within window area
This commit is contained in:
parent
3afca3e6a1
commit
71365a524f
9
dwm.c
9
dwm.c
|
@ -1039,6 +1039,8 @@ movemouse(Client *c) {
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
nx = ocx + (ev.xmotion.x - x1);
|
nx = ocx + (ev.xmotion.x - x1);
|
||||||
ny = ocy + (ev.xmotion.y - y1);
|
ny = ocy + (ev.xmotion.y - y1);
|
||||||
|
if(snap && nx >= wx && nx <= wx + ww
|
||||||
|
&& ny >= wy && ny <= wy + wh) {
|
||||||
if(abs(wx - nx) < snap)
|
if(abs(wx - nx) < snap)
|
||||||
nx = wx;
|
nx = wx;
|
||||||
else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
|
else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap)
|
||||||
|
@ -1049,6 +1051,7 @@ movemouse(Client *c) {
|
||||||
ny = wy + wh - c->h - 2 * c->bw;
|
ny = wy + wh - c->h - 2 * c->bw;
|
||||||
if(!c->isfloating && lt->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
|
if(!c->isfloating && lt->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
|
||||||
togglefloating(NULL);
|
togglefloating(NULL);
|
||||||
|
}
|
||||||
if(!lt->arrange || c->isfloating)
|
if(!lt->arrange || c->isfloating)
|
||||||
resize(c, nx, ny, c->w, c->h, False);
|
resize(c, nx, ny, c->w, c->h, False);
|
||||||
break;
|
break;
|
||||||
|
@ -1193,7 +1196,11 @@ resizemouse(Client *c) {
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
||||||
nh = MAX(ev.xmotion.y - ocy - 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)) {
|
|
||||||
|
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);
|
togglefloating(NULL);
|
||||||
}
|
}
|
||||||
if(!lt->arrange || c->isfloating)
|
if(!lt->arrange || c->isfloating)
|
||||||
|
|
Loading…
Reference in a new issue