mirror of
https://codeberg.org/frosty/dwm.git
synced 2024-09-19 03:36:55 -04:00
patch: resizehere
This commit is contained in:
parent
d22fb1a46a
commit
9f04529dd5
14
dwm.c
14
dwm.c
|
@ -1395,7 +1395,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||
void
|
||||
resizemouse(const Arg *arg)
|
||||
{
|
||||
int ocx, ocy, nw, nh;
|
||||
int x, y, ocw, och, nw, nh;
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XEvent ev;
|
||||
|
@ -1405,12 +1405,13 @@ resizemouse(const Arg *arg)
|
|||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||
return;
|
||||
restack(selmon);
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
ocw = c->w;
|
||||
och = c->h;
|
||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||
if(!getrootptr(&x, &y))
|
||||
return;
|
||||
do {
|
||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
||||
switch(ev.type) {
|
||||
|
@ -1420,8 +1421,8 @@ resizemouse(const Arg *arg)
|
|||
handler[ev.type](&ev);
|
||||
break;
|
||||
case MotionNotify:
|
||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
||||
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
||||
nw = MAX(ocw + (ev.xmotion.x - x), 1);
|
||||
nh = MAX(och + (ev.xmotion.y - y), 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)
|
||||
{
|
||||
|
@ -1434,7 +1435,6 @@ resizemouse(const Arg *arg)
|
|||
break;
|
||||
}
|
||||
} while (ev.type != ButtonRelease);
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
||||
|
|
Loading…
Reference in a new issue