sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4e9c00deef6dabea6a2afcc860f09335f874ad3e
parent 8b47d42fa389d7d91896477199141ecda4d7e7bf
Author: dspr <unknown>
Date:   Wed, 23 Jun 2010 18:55:52 -0400

added a patch to add gesture support to dwm. Also, a description of it.
Diffstat:
Adwm.suckless.org/patches/gesturepatch.diff | 122+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/gestures.md | 15+++++++++++++++
2 files changed, 137 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/gesturepatch.diff b/dwm.suckless.org/patches/gesturepatch.diff @@ -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 +@@ -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} }, +@@ -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 +@@ -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; +@@ -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"; +@@ -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 --git a/dwm.suckless.org/patches/gestures.md b/dwm.suckless.org/patches/gestures.md @@ -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@students.rowan.edu>