[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Wed, 23 Jun 2010 23:43:27 +0000 (UTC)

changeset: 565:af7e4ed2e522
tag: tip
user: dspr
date: Wed Jun 23 19:42:05 2010 -0400
files: dwm.suckless.org/patches/dwm-5.8-gestures.diff dwm.suckless.org/patches/gesturepatch.diff dwm.suckless.org/patches/gestures.md
description:
changes the naming of the gestures patch to be standard. Also updated it so that a gesture can
call any dwn function, rather than just calling execlp on a string.


diff -r b7181528ea44 -r af7e4ed2e522 dwm.suckless.org/patches/dwm-5.8-gestures.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/dwm-5.8-gestures.diff Wed Jun 23 19:42:05 2010 -0400
_AT_@ -0,0 +1,94 @@
+diff dwm-5.8.2/config.h dwm-5.8.2mod/config.h
+92a93
+> { ClkWinTitle, 0, Button3, startgesture, {0} },
+100a102,113
+> };
+>
+> //may want to reuse the architecture present in buttons[] and keys[]
+> static Gesture gestures[] = {
+> {"dl", spawn, SHCMD("konqueror") },
+> {"dr", spawn, SHCMD("pidgin" ) },
+> {"l", spawn, SHCMD("xterm") },
+> {"ld", spawn, SHCMD("gimp" ) },
+> {"lr", spawn, SHCMD("google-chrome") },
+> {"r" , spawn, SHCMD("firefox") },
+> {"rl", spawn, SHCMD("pavucontrol") },
+> {"du", spawn, SHCMD("kate") },
+Only in dwm-5.8.2mod: config.h~
+Binary files dwm-5.8.2/dwm and dwm-5.8.2mod/dwm differ
+diff dwm-5.8.2/dwm.c dwm-5.8.2mod/dwm.c
+73a74,79
+> char *name;
+> void (*func)(const Arg *arg);
+> const Arg arg;
+> } Gesture;
+>
+> typedef struct {
+244a251
+> static void startgesture(const Arg *arg);
+1248a1256,1318
+>
+> void
+> startgesture(const Arg *arg) {
+> int x, y, dx, dy, q;
+> int valid=0, listpos=0, gestpos=0, count=0;
+> char move, currGest[10];
+> XEvent ev;
+>
+> if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+> None, cursor[CurMove], CurrentTime) != GrabSuccess)
+> return;
+> if(!getrootptr(&x, &y))
+> return;
+> do {
+> XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+> switch (ev.type) {
+> case ConfigureRequest:
+> case Expose:
+> case MapRequest:
+> handler[ev.type](&ev);
+> break;
+> case MotionNotify:
+> if(count++ < 10)
+> break;
+> count = 0;
+> dx = ev.xmotion.x - x;
+> dy = ev.xmotion.y - y;
+> x = ev.xmotion.x;
+> y = ev.xmotion.y;
+>
+> if( abs(dx)/(abs(dy)+1) == 0 )
+> move = dy<0?'u':'d';
+> else
+> move = dx<0?'l':'r';
+>
+> if(move!=currGest[gestpos-1])
+> {
+> if(gestpos>9)
+> { ev.type++;
+> break;
+> }
+>
+> currGest[gestpos] = move;
+> currGest[++gestpos] = '\0';
+>
+> valid = 0;
+> for(q = 0; q<LENGTH(gestures); q++)
+> { if(!strcmp(currGest, gestures[q].name))
+> { valid++;
+> listpos = q;
+> }
+> }
+> }
+>
+> }
+> } while(ev.type != ButtonRelease);
+>
+> if(valid)
+> gestures[listpos].func(&(gestures[listpos].arg));
+>
+> XUngrabPointer(dpy, CurrentTime);
+> }
+>
+Only in dwm-5.8.2mod: dwm.c~
+Binary files dwm-5.8.2/dwm.o and dwm-5.8.2mod/dwm.o differ
diff -r b7181528ea44 -r af7e4ed2e522 dwm.suckless.org/patches/gesturepatch.diff
--- a/dwm.suckless.org/patches/gesturepatch.diff Wed Jun 23 18:55:52 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
_AT_@ -1,122 +0,0 @@
-diff -up dwm-5.8.2/config.h dwm-5.8.2mod/config.h
---- dwm-5.8.2/config.h 2010-06-23 15:24:00.000000000 -0400
-+++ dwm-5.8.2mod/config.h 2010-06-23 15:26:05.000000000 -0400
-_AT_@ -90,6 +90,7 @@ static Button buttons[] = {
- { ClkLtSymbol, 0, Button1, setlayout, {0} },
- { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
- { ClkWinTitle, 0, Button2, zoom, {0} },
-+ { ClkWinTitle, 0, Button3, startgesture, {0} },
- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
- { ClkClientWin, MODKEY, Button1, movemouse, {0} },
- { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
-_AT_@ -100,3 +101,15 @@ static Button buttons[] = {
- { ClkTagBar, MODKEY, Button3, toggletag, {0} },
- };
-
-+//may want to reuse the architecture present in buttons[] and keys[]
-+static Gesture gestures[] = {
-+ {"dl", "konqueror" },
-+ {"dr", "pidgin" },
-+ {"l", "xterm"},
-+ {"ld", "gimp" },
-+ {"lr", "google-chrome"},
-+ {"r" , "firefox"},
-+ {"rl", "pavucontrol"},
-+ {"du", "kate"},
-+};
-+
-Binary files dwm-5.8.2/dwm and dwm-5.8.2mod/dwm differ
-diff -up dwm-5.8.2/dwm.c dwm-5.8.2mod/dwm.c
---- dwm-5.8.2/dwm.c 2010-06-04 06:39:15.000000000 -0400
-+++ dwm-5.8.2mod/dwm.c 2010-06-23 15:29:30.000000000 -0400
-_AT_@ -71,6 +71,11 @@ typedef union {
- } Arg;
-
- typedef struct {
-+ char *name;
-+ char *cmd;
-+} Gesture;
-+
-+typedef struct {
- unsigned int click;
- unsigned int mask;
- unsigned int button;
-_AT_@ -242,6 +247,7 @@ static int xerror(Display *dpy, XErrorEv
- static int xerrordummy(Display *dpy, XErrorEvent *ee);
- static int xerrorstart(Display *dpy, XErrorEvent *ee);
- static void zoom(const Arg *arg);
-+static void startgesture(const Arg *arg);
-
- /* variables */
- static const char broken[] = "broken";
-_AT_@ -1247,6 +1253,69 @@ movemouse(const Arg *arg) {
- }
- }
-
-+void
-+startgesture(const Arg *arg) {
-+ int x, y, dx, dy, q;
-+ int valid=0, listpos=0, gestpos=0, count=0;
-+ char move, currGest[10];
-+ XEvent ev;
-+
-+ if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
-+ None, cursor[CurMove], CurrentTime) != GrabSuccess)
-+ return;
-+ if(!getrootptr(&x, &y))
-+ return;
-+ do {
-+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
-+ switch (ev.type) {
-+ case ConfigureRequest:
-+ case Expose:
-+ case MapRequest:
-+ handler[ev.type](&ev);
-+ break;
-+ case MotionNotify:
-+ if(count++ < 10)
-+ break;
-+ count = 0;
-+ dx = ev.xmotion.x - x;
-+ dy = ev.xmotion.y - y;
-+ x = ev.xmotion.x;
-+ y = ev.xmotion.y;
-+
-+ if( abs(dx)/(abs(dy)+1) == 0 )
-+ move = dy<0?'u':'d';
-+ else
-+ move = dx<0?'l':'r';
-+
-+ if(move!=currGest[gestpos-1])
-+ {
-+ if(gestpos>9)
-+ { ev.type++;
-+ break;
-+ }
-+
-+ currGest[gestpos] = move;
-+ currGest[++gestpos] = '\0';
-+
-+ valid = 0;
-+ for(q = 0; q<LENGTH(gestures); q++)
-+ { if(!strcmp(currGest, gestures[q].name))
-+ { valid++;
-+ listpos = q;
-+ }
-+ }
-+ }
-+
-+ }
-+ } while(ev.type != ButtonRelease);
-+
-+ if(valid && !fork())
-+ execlp(gestures[listpos].cmd, gestures[listpos].cmd, NULL);
-+
-+ XUngrabPointer(dpy, CurrentTime);
-+}
-+
-+
- Client *
- nexttiled(Client *c) {
- for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
-Binary files dwm-5.8.2/dwm.o and dwm-5.8.2mod/dwm.o differ
diff -r b7181528ea44 -r af7e4ed2e522 dwm.suckless.org/patches/gestures.md
--- a/dwm.suckless.org/patches/gestures.md Wed Jun 23 18:55:52 2010 -0400
+++ b/dwm.suckless.org/patches/gestures.md Wed Jun 23 19:42:05 2010 -0400
_AT_@ -3,12 +3,12 @@
 
 Description
 -----------
-`gestures` adds support for simple mouse gestures to dwm. Currently gestures are
-only used for the execution of programs.
+`gestures` adds support for simple mouse gestures to dwm. The patch assumes make has been run
+and adds a gestures array to config.h. A gesture can call any dwm function. I usually call spawn.
 
 Download
 --------
-* [gesturepatch.diff](gesturepatch.diff) (4.0K) (20100623)
+* [dwm-5.8-gestures.diff](dwm-5.8-gestures.diff)
 
 Author
 ------
Received on Thu Jun 24 2010 - 01:43:27 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:20 CEST