[wiki] [sites] [dwm][patch][resizehere] Add patch || Gutyina Gergő

From: <git_AT_suckless.org>
Date: Thu, 24 Aug 2023 21:35:05 +0200

commit efed6780749a4e975d475abffb7d2ee3eb61e0ad
Author: Gutyina Gergő <gutyina.gergo.2_AT_gmail.com>
Date: Thu Aug 24 21:30:58 2023 +0200

    [dwm][patch][resizehere] Add patch

diff --git a/dwm.suckless.org/patches/resizehere/dwm-resizehere-20230824-e81f17d.diff b/dwm.suckless.org/patches/resizehere/dwm-resizehere-20230824-e81f17d.diff
new file mode 100644
index 00000000..ec02e29f
--- /dev/null
+++ b/dwm.suckless.org/patches/resizehere/dwm-resizehere-20230824-e81f17d.diff
_AT_@ -0,0 +1,61 @@
+From d2824944615917697c18555a397bf84f2249a722 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= <gutyina.gergo.2_AT_gmail.com>
+Date: Thu, 24 Aug 2023 15:06:56 +0200
+Subject: [PATCH] Resize clients without wrapping the pointer
+
+---
+ dwm.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index f1d86b2..8c661a2 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -1300,7 +1300,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;
+_AT_@ -1311,12 +1311,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) {
+_AT_@ -1330,8 +1331,8 @@ resizemouse(const Arg *arg)
+ continue;
+ lasttime = ev.xmotion.time;
+
+- 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)
+ {
+_AT_@ -1344,7 +1345,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) {
+--
+2.41.0
+
diff --git a/dwm.suckless.org/patches/resizehere/index.md b/dwm.suckless.org/patches/resizehere/index.md
new file mode 100644
index 00000000..29155ef6
--- /dev/null
+++ b/dwm.suckless.org/patches/resizehere/index.md
_AT_@ -0,0 +1,50 @@
+resizehere
+==========
+
+Description
+-----------
+Changes the resizing behaviour. Instead of warping the pointer to the bottom right corner,
+the pointer will stay in the same place and the window will resize as you move your mouse.
+
+ Positioning the Mouse over the Client
+ +-------------------------+
+ | |
+ | +---------+ |
+ | | | |
+ | | C | |
+ | | M | |
+ | +---------+ |
+ | |
+ +-------------------------+
+
+ Original behaviour:
+ Resizing warps the mouse to the bottom right corner
+ +-------------------------+
+ | |
+ | +-------------+ |
+ | | | |
+ | | C | |
+ | | | |
+ | +-------------M |
+ | |
+ +-------------------------+
+
+ New behaviour:
+ Mouse stays at the same place, resizing happens relative to mouse movement
+ +-------------------------+
+ | |
+ | +-------------+ |
+ | | | |
+ | | C | |
+ | | M | |
+ | +-------------+ |
+ | |
+ +-------------------------+
+
+Download
+--------
+* [dwm-resizehere-20230824-e81f17d.diff](dwm-resizehere-20230824-e81f17d.diff)
+
+Authors
+-------
+* Gergő Gutyina - <gutyina.gergo.2_AT_gmail.com>
Received on Thu Aug 24 2023 - 21:35:05 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 24 2023 - 21:37:09 CEST