about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-22 11:42:08 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-22 11:42:08 +0100
commit2c477cf66147d369ae8ff17acdce743c6811ee6a (patch)
tree121a031caf30be9f6931e37e26cf2469c8c7acfa /event.c
parent986ca73074ef165880c75ee46a4eb6a1b328dc5b (diff)
downloaddwm-2c477cf66147d369ae8ff17acdce743c6811ee6a.tar.gz
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Diffstat (limited to 'event.c')
-rw-r--r--event.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/event.c b/event.c
index f765fe1..ae08f86 100644
--- a/event.c
+++ b/event.c
@@ -2,6 +2,7 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
+#include <stdio.h>
 #include <stdlib.h>
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
@@ -11,8 +12,8 @@
 typedef struct {
 	unsigned long mod;
 	KeySym keysym;
-	void (*func)(Arg arg);
-	Arg arg;
+	void (*func)(const char *arg);
+	const char *arg;
 } Key;
 
 KEYS
@@ -112,27 +113,29 @@ resizemouse(Client *c) {
 
 static void
 buttonpress(XEvent *e) {
-	int x;
-	Arg a;
+	static char arg[8];
+	int i, x;
 	Client *c;
 	XButtonPressedEvent *ev = &e->xbutton;
 
+	arg[0] = 0;
 	if(barwin == ev->window) {
 		x = 0;
-		for(a.i = 0; a.i < ntags; a.i++) {
-			x += textw(tags[a.i]);
+		for(i = 0; i < ntags; i++) {
+			x += textw(tags[i]);
 			if(ev->x < x) {
+				snprintf(arg, sizeof arg, "%d", i);
 				if(ev->button == Button1) {
 					if(ev->state & MODKEY)
-						tag(a);
+						tag(arg);
 					else
-						view(a);
+						view(arg);
 				}
 				else if(ev->button == Button3) {
 					if(ev->state & MODKEY)
-						toggletag(a);
+						toggletag(arg);
 					else
-						toggleview(a);
+						toggleview(arg);
 				}
 				return;
 			}
@@ -140,8 +143,7 @@ buttonpress(XEvent *e) {
 		if(ev->x < x + blw)
 			switch(ev->button) {
 			case Button1:
-				a.i = -1;
-				setlayout(a);
+				setlayout("-1");
 				break;
 			}
 	}
@@ -154,7 +156,7 @@ buttonpress(XEvent *e) {
 			movemouse(c);
 		}
 		else if(ev->button == Button2)
-			zoom(a);
+			zoom(NULL);
 		else if(ev->button == Button3
 		&& (lt->arrange == versatile || c->isversatile) && !c->isfixed)
 		{
.de> 2006-07-11 21:24:10 +0200 committer Anselm R. Garbe <garbeam@wmii.de> 2006-07-11 21:24:10 +0200 added mouse-based resizals' href='/acidbong/suckless/dwm/commit/wm.h?h=6.4&id=b9da4b082eb658b4142b61c149212f414f7653b6'>b9da4b0 ^
439e15d ^
1076f2b
bf35794 ^
1076f2b
439e15d ^
bf35794 ^
1076f2b
7b5638f ^

c53980c ^
8b59083 ^
8b59083 ^


bf35794 ^

8b59083 ^

650a1fb ^
8b59083 ^
8b59083 ^


bf35794 ^


8b59083 ^

1076f2b
da2bbd3 ^
3399650 ^
1173723 ^

a05beb6 ^
2e836ec ^
a05beb6 ^
95e8d12 ^
901b3ed ^
4688ad1 ^
b355755 ^
1076f2b
72707c2 ^
bf35794 ^

1076f2b

b355755 ^
8cc7f3b ^
bf35794 ^
b355755 ^
66da153 ^

bf35794 ^

efa7e51 ^
bf35794 ^


bf35794 ^
39677ec ^
439e15d ^
dba2306 ^
3399650 ^
adaa28a ^


dba2306 ^
adaa28a ^
c0705ee ^
adaa28a ^
dfd84f9 ^
adaa28a ^
04eb016 ^
adaa28a ^

4688ad1 ^
adaa28a ^

3399650 ^
d7e1708 ^
dba2306 ^
c0705ee ^
adaa28a ^
c0705ee ^

8cc7f3b ^
d7e1708 ^
dba2306 ^
29355bd ^
b9da4b0 ^
9e8b325 ^
adaa28a ^
c47da14 ^
dba2306 ^
adaa28a ^
9e8b325 ^
dba2306 ^
adaa28a ^
dba2306 ^

e21d93b ^
937cabf ^
72707c2 ^
dba2306 ^
adaa28a ^
4688ad1 ^
adaa28a ^
1b63f83 ^

29355bd ^
8b59083 ^
8b59083 ^
adaa28a ^
c47da14 ^
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137