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
|
void
|
||||||
resizemouse(const Arg *arg)
|
resizemouse(const Arg *arg)
|
||||||
{
|
{
|
||||||
int ocx, ocy, nw, nh;
|
int x, y, ocw, och, nw, nh;
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
@ -1405,12 +1405,13 @@ resizemouse(const Arg *arg)
|
||||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||||
return;
|
return;
|
||||||
restack(selmon);
|
restack(selmon);
|
||||||
ocx = c->x;
|
ocw = c->w;
|
||||||
ocy = c->y;
|
och = c->h;
|
||||||
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(!getrootptr(&x, &y))
|
||||||
|
return;
|
||||||
do {
|
do {
|
||||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
||||||
switch(ev.type) {
|
switch(ev.type) {
|
||||||
|
@ -1420,8 +1421,8 @@ resizemouse(const Arg *arg)
|
||||||
handler[ev.type](&ev);
|
handler[ev.type](&ev);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
nw = MAX(ocw + (ev.xmotion.x - x), 1);
|
||||||
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
nh = MAX(och + (ev.xmotion.y - y), 1);
|
||||||
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
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)
|
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
||||||
{
|
{
|
||||||
|
@ -1434,7 +1435,6 @@ resizemouse(const Arg *arg)
|
||||||
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);
|
|
||||||
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 a new issue