[wiki] [sites] [dwm][patch][dragmfact] Fix patch to work with multiple monitors || Miles Alan

From: <git_AT_suckless.org>
Date: Mon, 09 Dec 2019 02:02:42 +0100

commit d95d5d1a32e239087f085326cf9f739edbcda05f
Author: Miles Alan <m_AT_milesalan.com>
Date: Sun Dec 8 19:00:54 2019 -0600

    [dwm][patch][dragmfact] Fix patch to work with multiple monitors

diff --git a/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff b/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff
index 988c803c..5ceb7238 100644
--- a/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff
+++ b/dwm.suckless.org/patches/dragmfact/dwm-dragmfact-6.2.diff
_AT_@ -1,17 +1,18 @@
-From ddfeb46e2d7767a37bb64b135f81555846096341 Mon Sep 17 00:00:00 2001
+From 17df87822b379ce47d0aba3c36c5ef0adf4a7c3e Mon Sep 17 00:00:00 2001
 From: Miles Alan <m_AT_milesalan.com>
-Date: Sat, 24 Aug 2019 22:33:01 -0500
-Subject: [PATCH] dragmfact: Mod + right click / drag in tiling to resize mfact
+Date: Sun, 8 Dec 2019 18:15:13 -0600
+Subject: [PATCH] Mod + Right click / drag in tiling mode to resize mfact.
+ Works with multiple monitors.
 
 ---
- dwm.c | 26 +++++++++++++++++---------
- 1 file changed, 17 insertions(+), 9 deletions(-)
+ dwm.c | 32 +++++++++++++++++++++++---------
+ 1 file changed, 23 insertions(+), 9 deletions(-)
 
 diff --git a/dwm.c b/dwm.c
-index 4465af1..650935a 100644
+index c15f679..e273803 100644
 --- a/dwm.c
 +++ b/dwm.c
-_AT_@ -1306,7 +1306,13 @@ resizemouse(const Arg *arg)
+_AT_@ -1911,7 +1911,16 @@ resizemouse(const Arg *arg)
          if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
                  None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
                  return;
_AT_@ -20,13 +21,16 @@ index 4465af1..650935a 100644
 + if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
 + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
 + } else {
-+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mw * selmon->mfact, selmon->mh / 2);
++ XWarpPointer(dpy, None, root, 0, 0, 0, 0,
++ selmon->mx + (selmon->ww * selmon->mfact),
++ selmon->my + (selmon->wh / 2)
++ );
 + }
 +
          do {
                  XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
                  switch(ev.type) {
-_AT_@ -1322,19 +1328,21 @@ resizemouse(const Arg *arg)
+_AT_@ -1927,19 +1936,24 @@ resizemouse(const Arg *arg)
  
                          nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
                          nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
_AT_@ -48,14 +52,17 @@ index 4465af1..650935a 100644
 + if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
 + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
 + } else {
-+ selmon->mfact = (double) ev.xmotion.x / (double) selmon->mw;
++ selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
 + arrange(selmon);
-+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->mw * selmon->mfact, selmon->mh / 2);
++ XWarpPointer(dpy, None, root, 0, 0, 0, 0,
++ selmon->mx + (selmon->ww * selmon->mfact),
++ selmon->my + (selmon->wh / 2)
++ );
 + }
 +
          XUngrabPointer(dpy, CurrentTime);
          while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
          if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
 --
-2.19.2
+2.23.0
 
Received on Mon Dec 09 2019 - 02:02:42 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 09 2019 - 02:12:35 CET