commit bf3006154186d82b4bd9bea00e2a037becd3a85f
parent 5362d2c983c06524269c7e2b84f4cbadc51298b6
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Mon, 9 Nov 2015 21:34:33 +0100
[dwm][warp] Update patch
Diffstat:
3 files changed, 60 insertions(+), 103 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-6.1-warp.diff b/dwm.suckless.org/patches/dwm-6.1-warp.diff
@@ -0,0 +1,57 @@
+diff --git a/dwm.c b/dwm.c
+index 0362114..d975c68 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -227,6 +227,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);
+@@ -840,6 +841,7 @@ focusmon(const Arg *arg)
+ in gedit and anjuta */
+ selmon = m;
+ focus(NULL);
++ warp(selmon->sel);
+ }
+
+ void
+@@ -1384,6 +1386,8 @@ restack(Monitor *m)
+ }
+ XSync(dpy, False);
+ while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
++ if (m == selmon && (m->tagset[m->seltags] & m->sel->tags))
++ warp(m->sel);
+ }
+
+ void
+@@ -2040,6 +2044,27 @@ view(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++warp(const Client *c)
++{
++ Window dummy;
++ int x, y, di;
++ unsigned int dui;
++
++ if (!c) {
++ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh/2);
++ return;
++ }
++
++ XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui);
++
++ if ((x > c->x && y > c->y && x < c->x + c->w && y < c->y + c->h) ||
++ (y > c->mon->by && y < c->mon->by + bh))
++ 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/historical/dwm-r1525-warp.diff b/dwm.suckless.org/patches/historical/dwm-r1525-warp.diff
@@ -1,99 +0,0 @@
-diff -r c361034c5a1c dwm.c
---- a/dwm.c Sat Sep 11 19:00:18 2010 +0000
-+++ b/dwm.c Sat Sep 11 21:47:56 2010 +0200
-@@ -236,6 +236,7 @@
- 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);
-@@ -274,6 +275,7 @@
- static DC dc;
- static Monitor *mons = NULL, *selmon = NULL;
- static Window root;
-+static Bool warpmouse = True;
-
- /* configuration, allows nested code to access above variables */
- #include "config.h"
-@@ -452,10 +454,12 @@
- focus(c);
- click = ClkClientWin;
- }
-+ warpmouse = False;
- for(i = 0; i < LENGTH(buttons); i++)
- if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
- && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
- buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
-+ warpmouse = True;
- }
-
- void
-@@ -854,6 +858,7 @@
- unfocus(selmon->sel, True);
- selmon = m;
- focus(NULL);
-+ warp(selmon->sel);
- }
-
- void
-@@ -879,6 +884,7 @@
- if(c) {
- focus(c);
- restack(selmon);
-+ warp(c);
- }
- }
-
-@@ -1150,6 +1156,7 @@
- XMapWindow(dpy, c->win);
- setclientstate(c, NormalState);
- arrange(c->mon);
-+ warp(c);
- }
-
- void
-@@ -1609,6 +1616,7 @@
- if(selmon->sel && arg->ui & TAGMASK) {
- selmon->sel->tags = arg->ui & TAGMASK;
- arrange(selmon);
-+ warp(selmon->sel);
- }
- }
-
-@@ -1689,6 +1697,7 @@
- if(newtags) {
- selmon->sel->tags = newtags;
- arrange(selmon);
-+ warp(selmon->sel);
- }
- }
-
-@@ -1962,6 +1971,26 @@
- arrange(selmon);
- }
-
-+void
-+warp(const Client *c) {
-+ Window dummy;
-+ int x, y, di;
-+ unsigned int dui;
-+
-+ if(!c || !warpmouse)
-+ return;
-+ XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui);
-+ if(x > c->x && y > c->y && x < c->y + c->w && y < c->y + c->h)
-+ return;
-+ XSelectInput(dpy, root, SubstructureRedirectMask
-+ & EnterWindowMask);
-+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
-+ c->w / 2, c->h / 2);
-+ XSelectInput(dpy, root, SubstructureRedirectMask | SubstructureNotifyMask
-+ | EnterWindowMask | LeaveWindowMask | StructureNotifyMask);
-+}
-+
-+
- Client *
- wintoclient(Window w) {
- Client *c;
diff --git a/dwm.suckless.org/patches/warp.md b/dwm.suckless.org/patches/warp.md
@@ -10,13 +10,12 @@ middle of the window.
Download
--------
-* [dwm-5.9-warp.diff](dwm-5.9-warp.diff) (1.3k) (20111028)
-* [dwm-r1525-warp.diff](historical/dwm-r1525-warp.diff) (2.3k) (20100911)
- In the patch for r1525, there is a problem with this caused by `XSelectInput`, causing the
- statusbar to freeze. Interestingly, the [stdin](stdin) patch works around this.
+* [dwm-5.9-warp.diff](dwm-5.9-warp.diff) (20111028)
+* [dwm-6.1-warp.diff](dwm-5.9-warp.diff) (20151109)
Author
------
* Evan Gates (emg) <evan.gates@gmail.com>
* Enno Boland (Gottox)
+* Jochen Sprickerhof