summaryrefslogtreecommitdiffstats
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
parentre-added xterm to config.default.h (diff)
downloaddwm-2c477cf66147d369ae8ff17acdce743c6811ee6a.tar.gz
dwm-2c477cf66147d369ae8ff17acdce743c6811ee6a.zip
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Diffstat (limited to '')
-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 @@
2 * See LICENSE file for license details. 2 * See LICENSE file for license details.
3 */ 3 */
4#include "dwm.h" 4#include "dwm.h"
5#include <stdio.h>
5#include <stdlib.h> 6#include <stdlib.h>
6#include <X11/keysym.h> 7#include <X11/keysym.h>
7#include <X11/Xatom.h> 8#include <X11/Xatom.h>
@@ -11,8 +12,8 @@
11typedef struct { 12typedef struct {
12 unsigned long mod; 13 unsigned long mod;
13 KeySym keysym; 14 KeySym keysym;
14 void (*func)(Arg arg); 15 void (*func)(const char *arg);
15 Arg arg; 16 const char *arg;
16} Key; 17} Key;
17 18
18KEYS 19KEYS
@@ -112,27 +113,29 @@ resizemouse(Client *c) {
112 113
113static void 114static void
114buttonpress(XEvent *e) { 115buttonpress(XEvent *e) {
115 int x; 116 static char arg[8];
116 Arg a; 117 int i, x;
117 Client *c; 118 Client *c;
118 XButtonPressedEvent *ev = &e->xbutton; 119 XButtonPressedEvent *ev = &e->xbutton;
119 120
121 arg[0] = 0;
120 if(barwin == ev->window) { 122 if(barwin == ev->window) {
121 x = 0; 123 x = 0;
122 for(a.i = 0; a.i < ntags; a.i++) { 124 for(i = 0; i < ntags; i++) {
123 x += textw(tags[a.i]); 125 x += textw(tags[i]);
124 if(ev->x < x) { 126 if(ev->x < x) {
127 snprintf(arg, sizeof arg, "%d", i);
125 if(ev->button == Button1) { 128 if(ev->button == Button1) {
126 if(ev->state & MODKEY) 129 if(ev->state & MODKEY)
127 tag(a); 130 tag(arg);
128 else 131 else
129 view(a); 132 view(arg);
130 } 133 }
131 else if(ev->button == Button3) { 134 else if(ev->button == Button3) {
132 if(ev->state & MODKEY) 135 if(ev->state & MODKEY)
133 toggletag(a); 136 toggletag(arg);
134 else 137 else
135 toggleview(a); 138 toggleview(arg);
136 } 139 }
137 return; 140 return;
138 } 141 }
@@ -140,8 +143,7 @@ buttonpress(XEvent *e) {
140 if(ev->x < x + blw) 143 if(ev->x < x + blw)
141 switch(ev->button) { 144 switch(ev->button) {
142 case Button1: 145 case Button1:
143 a.i = -1; 146 setlayout("-1");
144 setlayout(a);
145 break; 147 break;
146 } 148 }
147 } 149 }
@@ -154,7 +156,7 @@ buttonpress(XEvent *e) {
154 movemouse(c); 156 movemouse(c);
155 } 157 }
156 else if(ev->button == Button2) 158 else if(ev->button == Button2)
157 zoom(a); 159 zoom(NULL);
158 else if(ev->button == Button3 160 else if(ev->button == Button3
159 && (lt->arrange == versatile || c->isversatile) && !c->isfixed) 161 && (lt->arrange == versatile || c->isversatile) && !c->isfixed)
160 { 162 {