diff options
| author | Bear <bear@bengtsson.win> | 2021-12-27 09:29:58 +0000 |
|---|---|---|
| committer | Bear <bear@bengtsson.win> | 2021-12-27 09:29:58 +0000 |
| commit | 69262b01ced79c2d776fab9b889926d1816a1e7a (patch) | |
| tree | f304cd6fa8734e83a7772d07dc9b484781565155 /patch/tapresize.c | |
Added DWM
Diffstat (limited to 'patch/tapresize.c')
| -rw-r--r-- | patch/tapresize.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/patch/tapresize.c b/patch/tapresize.c new file mode 100644 index 0000000..c236b5d --- /dev/null +++ b/patch/tapresize.c @@ -0,0 +1,39 @@ +void +resizemousescroll(const Arg *arg) +{ + int nw, nh; + Client *c; + Monitor *m; + XEvent ev; + int dw = *((int*)arg->v + 1); + int dh = *(int*)arg->v; + + if (!(c = selmon->sel)) + return; + if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ + return; + restack(selmon); + if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, + None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) + return; + nw = MAX(c->w + dw, 1); + nh = MAX(c->h + dh, 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) + resize(c, c->x, c->y, nw, nh, 1); + 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) { + sendmon(c, m); + selmon = m; + focus(NULL); + } +} + |
