commit a87a7613c4e7a67a51703aa5eed6f651787ed646
parent a56589966cf3c7bbef406d4f208398e3623897b6
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Sun, 26 Jun 2016 20:28:52 +0200
[dwm][warp] update patch
Diffstat:
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/dwm.suckless.org/patches/dwm-warp-git-20160626-7af4d43.diff b/dwm.suckless.org/patches/dwm-warp-git-20160626-7af4d43.diff
@@ -0,0 +1,58 @@
+diff --git a/dwm.c b/dwm.c
+index b2bc9bd..0329e1f 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -228,6 +228,7 @@ static void updatewindowtype(Client *c);
+ static void updatetitle(Client *c);
+ static void updatewmhints(Client *c);
+ static void view(const Arg *arg);
++static void warp(const Client *c);
+ static Client *wintoclient(Window w);
+ static Monitor *wintomon(Window w);
+ static int xerror(Display *dpy, XErrorEvent *ee);
+@@ -842,6 +843,7 @@ focusmon(const Arg *arg)
+ in gedit and anjuta */
+ selmon = m;
+ focus(NULL);
++ warp(selmon->sel);
+ }
+
+ void
+@@ -1387,6 +1389,8 @@ restack(Monitor *m)
+ }
+ XSync(dpy, False);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
++ if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
++ warp(m->sel);
+ }
+
+ void
+@@ -2039,6 +2043,28 @@ view(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++warp(const Client *c)
++{
++ int x, y;
++
++ if (!c) {
++ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
++ return;
++ }
++
++ if (!getrootptr(&x, &y) ||
++ (x > c->x - c->bw &&
++ y > c->y - c->bw &&
++ x < c->x + c->w + c->bw*2 &&
++ y < c->y + c->h + c->bw*2) ||
++ (y > c->mon->by && y < c->mon->by + bh) ||
++ (c->mon->topbar && !y))
++ return;
++
++ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
++}
++
+ Client *
+ wintoclient(Window w)
+ {
diff --git a/dwm.suckless.org/patches/warp.md b/dwm.suckless.org/patches/warp.md
@@ -13,11 +13,12 @@ Download
* [dwm-5.9-warp.diff](dwm-5.9-warp.diff) (20111028)
* [dwm-6.1-warp.diff](dwm-6.1-warp.diff) (20151215)
+* [dwm-warp-git-20160626-7af4d43.diff](dwm-warp-git-20160626-7af4d43.diff)
Author
------
* Evan Gates (emg) <evan.gates@gmail.com>
* Enno Boland (Gottox)
-* Jochen Sprickerhof
+* [Jochen Sprickerhof](mailto:project@firstname.lastname.de) (don't warp in monocle)
* Winston Weinert (winny) <winston@ml1.net>