about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c20
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;
 
1aa9c5661ec9ee32fe9fbdc230c29d30d27e4'>2ed1aa9c ^
51530916 ^

de49fb42 ^


b39ceb27 ^
df0b469f ^
b39ceb27 ^






51530916 ^
b39ceb27 ^
9e608a77 ^

ac0e9db5 ^
6179649e ^
9e608a77 ^


b39ceb27 ^
683d53ca ^
b39ceb27 ^


683d53ca ^

b39ceb27 ^
df0b469f ^
ccd792da ^
51530916 ^
ac0e9db5 ^
7d13531e ^



eb3a527a ^


fb4836dc ^
eb3a527a ^
51530916 ^

0f125d5f ^
37537bf3 ^


86acd630 ^

0f125d5f ^
eb3a527a ^
65ccad4c ^
6673e1fc ^
40be2522 ^
eb3a527a ^



37537bf3 ^









51530916 ^
f278a15d ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110