Compare commits

...

2 Commits

Author SHA1 Message Date
Jakub
684ff9bb71 make drag mfact compatible with pertag 2024-05-16 22:52:37 -04:00
Jakub
3d0629b664 have drag m fact live redraw 2024-05-16 22:52:37 -04:00

12
dwm.c
View File

@ -1670,6 +1670,7 @@ void
resizemouse(const Arg *arg) resizemouse(const Arg *arg)
{ {
int ocx, ocy, nw, nh; int ocx, ocy, nw, nh;
unsigned int i;
Client *c; Client *c;
Monitor *m; Monitor *m;
XEvent ev; XEvent ev;
@ -1713,6 +1714,15 @@ resizemouse(const Arg *arg)
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);
else {
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
for(i=0; i<LENGTH(tags); ++i)
if(selmon->tagset[selmon->seltags] & 1<<i)
selmon->pertag->mfacts[i+1] = selmon->mfact;
if(selmon->pertag->curtag == 0)
selmon->pertag->mfacts[0] = selmon->mfact;
arrange(selmon);
}
break; break;
} }
} while (ev.type != ButtonRelease); } while (ev.type != ButtonRelease);
@ -1720,8 +1730,6 @@ resizemouse(const Arg *arg)
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) { 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); XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
} else { } else {
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
arrange(selmon);
XWarpPointer(dpy, None, root, 0, 0, 0, 0, XWarpPointer(dpy, None, root, 0, 0, 0, 0,
selmon->mx + (selmon->ww * selmon->mfact), selmon->mx + (selmon->ww * selmon->mfact),
selmon->my + (selmon->wh / 2) selmon->my + (selmon->wh / 2)