diff options
author | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-16 17:55:55 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-16 17:55:55 +0200 |
commit | 10bc0ce912eb99fec49d954c80d92e04429ed0ee (patch) | |
tree | 524951e34fcd67e59b672c4ae203b71f94a214b3 /event.c | |
parent | e8792d95a12c85f9e660e192cd2c6260a01a3c5e (diff) | |
download | dwm-10bc0ce912eb99fec49d954c80d92e04429ed0ee.tar.gz |
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Diffstat (limited to 'event.c')
-rw-r--r-- | event.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/event.c b/event.c index b8a16a7..4e240e2 100644 --- a/event.c +++ b/event.c @@ -1,6 +1,5 @@ /* See LICENSE file for copyright and license details. */ #include "dwm.h" -#include <stdio.h> #include <stdlib.h> #include <X11/keysym.h> #include <X11/Xatom.h> @@ -15,8 +14,6 @@ typedef struct { const char *arg; } Key; -KEYS - #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) #define MOUSEMASK (BUTTONMASK | PointerMotionMask) @@ -112,29 +109,26 @@ resizemouse(Client *c) { static void buttonpress(XEvent *e) { - static char buf[32]; unsigned int i, x; Client *c; XButtonPressedEvent *ev = &e->xbutton; - buf[0] = 0; if(barwin == ev->window) { x = 0; for(i = 0; i < ntags; i++) { x += textw(tags[i]); if(ev->x < x) { - snprintf(buf, sizeof buf, "%d", i); if(ev->button == Button1) { if(ev->state & MODKEY) - tag(buf); + tag(tags[i]); else - view(buf); + view(tags[i]); } else if(ev->button == Button3) { if(ev->state & MODKEY) - toggletag(buf); + toggletag(tags[i]); else - toggleview(buf); + toggleview(tags[i]); } return; } @@ -257,7 +251,8 @@ expose(XEvent *e) { static void keypress(XEvent *e) { - static unsigned int len = sizeof key / sizeof key[0]; + KEYS + unsigned int len = sizeof key / sizeof key[0]; unsigned int i; KeySym keysym; XKeyEvent *ev = &e->xkey; @@ -362,7 +357,8 @@ void (*handler[LASTEvent]) (XEvent *) = { void grabkeys(void) { - static unsigned int len = sizeof key / sizeof key[0]; + KEYS + unsigned int len = sizeof key / sizeof key[0]; unsigned int i; KeyCode code; |