[wiki] [sites] Explain relationship between warp and stdin dwm patches || fg

From: <hg_AT_suckless.org>
Date: Sat, 17 Nov 2012 21:48:17 +0100 (CET)

changeset: 1010:1003d71ce8b3
tag: tip
user: fg_AT_bly.fritz.box
date: Sat Nov 17 21:43:44 2012 +0100
files: dwm.suckless.org/patches/dwm-r1525-warp.diff dwm.suckless.org/patches/historical/dwm-r1525-warp.diff dwm.suckless.org/patches/stdin.md dwm.suckless.org/patches/warp.md
description:
Explain relationship between warp and stdin dwm patches


diff -r 83d9be6a8c73 -r 1003d71ce8b3 dwm.suckless.org/patches/dwm-r1525-warp.diff
--- a/dwm.suckless.org/patches/dwm-r1525-warp.diff Sat Nov 17 18:20:43 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
_AT_@ -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
-_AT_@ -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);
-_AT_@ -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"
-_AT_@ -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
-_AT_@ -854,6 +858,7 @@
- unfocus(selmon->sel, True);
- selmon = m;
- focus(NULL);
-+ warp(selmon->sel);
- }
-
- void
-_AT_@ -879,6 +884,7 @@
- if(c) {
- focus(c);
- restack(selmon);
-+ warp(c);
- }
- }
-
-_AT_@ -1150,6 +1156,7 @@
- XMapWindow(dpy, c->win);
- setclientstate(c, NormalState);
- arrange(c->mon);
-+ warp(c);
- }
-
- void
-_AT_@ -1609,6 +1616,7 @@
- if(selmon->sel && arg->ui & TAGMASK) {
- selmon->sel->tags = arg->ui & TAGMASK;
- arrange(selmon);
-+ warp(selmon->sel);
- }
- }
-
-_AT_@ -1689,6 +1697,7 @@
- if(newtags) {
- selmon->sel->tags = newtags;
- arrange(selmon);
-+ warp(selmon->sel);
- }
- }
-
-_AT_@ -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 -r 83d9be6a8c73 -r 1003d71ce8b3 dwm.suckless.org/patches/historical/dwm-r1525-warp.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/historical/dwm-r1525-warp.diff Sat Nov 17 21:43:44 2012 +0100
_AT_@ -0,0 +1,99 @@
+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
+_AT_@ -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);
+_AT_@ -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"
+_AT_@ -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
+_AT_@ -854,6 +858,7 @@
+ unfocus(selmon->sel, True);
+ selmon = m;
+ focus(NULL);
++ warp(selmon->sel);
+ }
+
+ void
+_AT_@ -879,6 +884,7 @@
+ if(c) {
+ focus(c);
+ restack(selmon);
++ warp(c);
+ }
+ }
+
+_AT_@ -1150,6 +1156,7 @@
+ XMapWindow(dpy, c->win);
+ setclientstate(c, NormalState);
+ arrange(c->mon);
++ warp(c);
+ }
+
+ void
+_AT_@ -1609,6 +1616,7 @@
+ if(selmon->sel && arg->ui & TAGMASK) {
+ selmon->sel->tags = arg->ui & TAGMASK;
+ arrange(selmon);
++ warp(selmon->sel);
+ }
+ }
+
+_AT_@ -1689,6 +1697,7 @@
+ if(newtags) {
+ selmon->sel->tags = newtags;
+ arrange(selmon);
++ warp(selmon->sel);
+ }
+ }
+
+_AT_@ -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 -r 83d9be6a8c73 -r 1003d71ce8b3 dwm.suckless.org/patches/stdin.md
--- a/dwm.suckless.org/patches/stdin.md Sat Nov 17 18:20:43 2012 +0100
+++ b/dwm.suckless.org/patches/stdin.md Sat Nov 17 21:43:44 2012 +0100
_AT_@ -4,10 +4,10 @@
 Description
 -----------
 
-This backports dwm's old behaviour found in pre-5.3 releases to read the status
-text from stdin. It's a matter of personal preference, adds a few LOC, is less
-prone to freezing (in my experience) and included here for the sake of
-completeness.
+dwm releases before 5.3 read the status text from stdin.
+This patch is mainly a workaround for the freezing issue caused by
+`XSelectInput` with the previous version of the [warp](warp) patch.
+Some people might like to write their status to a pipe, though.
 
 Download
 --------
_AT_@ -17,6 +17,5 @@
 Author
 ------
 
-This was originally part of dwm-5.2 and written by Anselm R. Garbe,
-but the one to blame for the backport is Moritz Wilhelmy, who can be reached by
-writing a mail to moritz plus dwm at wzff dot de.
+This was originally part of dwm-5.2 and written by Anselm R. Garbe.
+It was ported to later versions of dwm by Moritz Wilhelmy, mw wzff de.
diff -r 83d9be6a8c73 -r 1003d71ce8b3 dwm.suckless.org/patches/warp.md
--- a/dwm.suckless.org/patches/warp.md Sat Nov 17 18:20:43 2012 +0100
+++ b/dwm.suckless.org/patches/warp.md Sat Nov 17 21:43:44 2012 +0100
_AT_@ -11,15 +11,12 @@
 --------
 
 * [dwm-5.9-warp.diff](dwm-5.9-warp.diff) (1.3k) (20111028)
-* [dwm-r1525-warp.diff](dwm-r1525-warp.diff) (2.3k) (20100911)
+* [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.
 
 Author
 ------
 
-* Evan Gates (emg)<evan.gates_AT_gmail.com>
+* Evan Gates (emg) <evan.gates_AT_gmail.com>
 * Enno Boland (Gottox)
-
-Contributor
------------
-
-* Moritz Wilhelmy (n0nsense) `<`moritz plus dwm at wzff dot de`>` - did the port to r1525
Received on Sat Nov 17 2012 - 21:48:17 CET

This archive was generated by hypermail 2.3.0 : Sat Nov 17 2012 - 22:00:09 CET