dragmfact
This commit is contained in:
parent
d85a36932d
commit
9a39d34100
32
dwm.c
32
dwm.c
|
@ -1542,7 +1542,16 @@ resizemouse(const Arg *arg)
|
||||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
|
||||||
|
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||||
|
} else {
|
||||||
|
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
|
||||||
|
selmon->mx + (selmon->ww * selmon->mfact),
|
||||||
|
selmon->my + (selmon->wh / 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
||||||
switch(ev.type) {
|
switch(ev.type) {
|
||||||
|
@ -1558,19 +1567,24 @@ resizemouse(const Arg *arg)
|
||||||
|
|
||||||
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->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
|
||||||
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
|
||||||
{
|
|
||||||
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
|
|
||||||
&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
|
|
||||||
togglefloating(NULL);
|
|
||||||
}
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||||
resize(c, c->x, c->y, nw, nh, 1);
|
resize(c, c->x, c->y, nw, nh, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (ev.type != ButtonRelease);
|
} while (ev.type != ButtonRelease);
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
|
||||||
|
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||||
|
} else {
|
||||||
|
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
|
||||||
|
arrange(selmon);
|
||||||
|
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
|
||||||
|
selmon->mx + (selmon->ww * selmon->mfact),
|
||||||
|
selmon->my + (selmon->wh / 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
||||||
|
|
Loading…
Reference in New Issue