diff options
| author | verschmelzen <[email protected]> | 2021-03-30 22:31:45 +0300 |
|---|---|---|
| committer | verschmelzen <[email protected]> | 2021-03-30 22:49:59 +0300 |
| commit | 07277cc460d73dd0c330257812180894f5c4c77e (patch) | |
| tree | c3f7ce72f7c86c2e21085d60a392e26c371502d0 /patch | |
| parent | 4751d7388d3c7ecf1084747ae0b7da79691fc696 (diff) | |
| download | dwm-flexipatch-07277cc460d73dd0c330257812180894f5c4c77e.tar.gz dwm-flexipatch-07277cc460d73dd0c330257812180894f5c4c77e.zip | |
Add tapresize patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 | ||||
| -rw-r--r-- | patch/tapresize.c | 38 | ||||
| -rw-r--r-- | patch/tapresize.h | 1 |
4 files changed, 45 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index 73c3536..02ba47b 100644 --- a/patch/include.c +++ b/patch/include.c @@ -268,6 +268,9 @@ #if TAGSWAPMON_PATCH #include "tagswapmon.c" #endif +#if TAPRESIZE_PATCH +#include "tapresize.c" +#endif #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.c" #endif diff --git a/patch/include.h b/patch/include.h index 27cf77b..7aab494 100644 --- a/patch/include.h +++ b/patch/include.h @@ -264,6 +264,9 @@ #if TAGSWAPMON_PATCH #include "tagswapmon.h" #endif +#if TAPRESIZE_PATCH +#include "tapresize.h" +#endif #if TOGGLEFULLSCREEN_PATCH #include "togglefullscreen.h" #endif diff --git a/patch/tapresize.c b/patch/tapresize.c new file mode 100644 index 0000000..546aa50 --- /dev/null +++ b/patch/tapresize.c @@ -0,0 +1,38 @@ +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); + } +} diff --git a/patch/tapresize.h b/patch/tapresize.h new file mode 100644 index 0000000..867f9a0 --- /dev/null +++ b/patch/tapresize.h @@ -0,0 +1 @@ +static void resizemousescroll(const Arg *arg); |
