[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Wed, 23 Jun 2010 22:57:17 +0000 (UTC)

changeset: 564:b7181528ea44
tag: tip
user: dspr
date: Wed Jun 23 18:55:52 2010 -0400
files: dwm.suckless.org/patches/gesturepatch.diff dwm.suckless.org/patches/gestures.md
description:
added a patch to add gesture support to dwm. Also, a description of it.


diff -r 38e12904c2a9 -r b7181528ea44 dwm.suckless.org/patches/gesturepatch.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/gesturepatch.diff Wed Jun 23 18:55:52 2010 -0400
_AT_@ -0,0 +1,122 @@
+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 38e12904c2a9 -r b7181528ea44 dwm.suckless.org/patches/gestures.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/gestures.md Wed Jun 23 18:55:52 2010 -0400
_AT_@ -0,0 +1,15 @@
+GESTURES
+========
+
+Description
+-----------
+`gestures` adds support for simple mouse gestures to dwm. Currently gestures are
+only used for the execution of programs.
+
+Download
+--------
+* [gesturepatch.diff](gesturepatch.diff) (4.0K) (20100623)
+
+Author
+------
+* David Galos - <galosd83_AT_students.rowan.edu>
Received on Thu Jun 24 2010 - 00:57:17 CEST

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