summaryrefslogtreecommitdiffstats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'event.c')
-rw-r--r--event.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/event.c b/event.c
index 74ae276..c59385d 100644
--- a/event.c
+++ b/event.c
@@ -21,8 +21,7 @@ KEYS
21#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) 21#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
22 22
23static void 23static void
24movemouse(Client *c) 24movemouse(Client *c) {
25{
26 int x1, y1, ocx, ocy, di; 25 int x1, y1, ocx, ocy, di;
27 unsigned int dui; 26 unsigned int dui;
28 Window dummy; 27 Window dummy;
@@ -37,7 +36,8 @@ movemouse(Client *c)
37 for(;;) { 36 for(;;) {
38 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); 37 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
39 switch (ev.type) { 38 switch (ev.type) {
40 default: break; 39 default:
40 break;
41 case Expose: 41 case Expose:
42 handler[Expose](&ev); 42 handler[Expose](&ev);
43 break; 43 break;
@@ -55,8 +55,7 @@ movemouse(Client *c)
55} 55}
56 56
57static void 57static void
58resizemouse(Client *c) 58resizemouse(Client *c) {
59{
60 int ocx, ocy; 59 int ocx, ocy;
61 int nw, nh; 60 int nw, nh;
62 Corner sticky; 61 Corner sticky;
@@ -71,7 +70,8 @@ resizemouse(Client *c)
71 for(;;) { 70 for(;;) {
72 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); 71 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev);
73 switch(ev.type) { 72 switch(ev.type) {
74 default: break; 73 default:
74 break;
75 case Expose: 75 case Expose:
76 handler[Expose](&ev); 76 handler[Expose](&ev);
77 break; 77 break;
@@ -97,8 +97,7 @@ resizemouse(Client *c)
97} 97}
98 98
99static void 99static void
100buttonpress(XEvent *e) 100buttonpress(XEvent *e) {
101{
102 int x; 101 int x;
103 Arg a; 102 Arg a;
104 Client *c; 103 Client *c;
@@ -147,8 +146,7 @@ buttonpress(XEvent *e)
147} 146}
148 147
149static void 148static void
150synconfig(Client *c, int x, int y, int w, int h, unsigned int border) 149synconfig(Client *c, int x, int y, int w, int h, unsigned int border) {
151{
152 XEvent synev; 150 XEvent synev;
153 151
154 synev.type = ConfigureNotify; 152 synev.type = ConfigureNotify;
@@ -165,8 +163,7 @@ synconfig(Client *c, int x, int y, int w, int h, unsigned int border)
165} 163}
166 164
167static void 165static void
168configurerequest(XEvent *e) 166configurerequest(XEvent *e) {
169{
170 unsigned long newmask; 167 unsigned long newmask;
171 Client *c; 168 Client *c;
172 XConfigureRequestEvent *ev = &e->xconfigurerequest; 169 XConfigureRequestEvent *ev = &e->xconfigurerequest;
@@ -219,8 +216,7 @@ configurerequest(XEvent *e)
219} 216}
220 217
221static void 218static void
222destroynotify(XEvent *e) 219destroynotify(XEvent *e) {
223{
224 Client *c; 220 Client *c;
225 XDestroyWindowEvent *ev = &e->xdestroywindow; 221 XDestroyWindowEvent *ev = &e->xdestroywindow;
226 222
@@ -229,8 +225,7 @@ destroynotify(XEvent *e)
229} 225}
230 226
231static void 227static void
232enternotify(XEvent *e) 228enternotify(XEvent *e) {
233{
234 Client *c; 229 Client *c;
235 XCrossingEvent *ev = &e->xcrossing; 230 XCrossingEvent *ev = &e->xcrossing;
236 231
@@ -247,8 +242,7 @@ enternotify(XEvent *e)
247} 242}
248 243
249static void 244static void
250expose(XEvent *e) 245expose(XEvent *e) {
251{
252 Client *c; 246 Client *c;
253 XExposeEvent *ev = &e->xexpose; 247 XExposeEvent *ev = &e->xexpose;
254 248
@@ -261,8 +255,7 @@ expose(XEvent *e)
261} 255}
262 256
263static void 257static void
264keypress(XEvent *e) 258keypress(XEvent *e) {
265{
266 static unsigned int len = sizeof(key) / sizeof(key[0]); 259 static unsigned int len = sizeof(key) / sizeof(key[0]);
267 unsigned int i; 260 unsigned int i;
268 KeySym keysym; 261 KeySym keysym;
@@ -270,8 +263,8 @@ keypress(XEvent *e)
270 263
271 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); 264 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
272 for(i = 0; i < len; i++) { 265 for(i = 0; i < len; i++) {
273 if(keysym == key[i].keysym && 266 if(keysym == key[i].keysym
274 CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) 267 && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
275 { 268 {
276 if(key[i].func) 269 if(key[i].func)
277 key[i].func(&key[i].arg); 270 key[i].func(&key[i].arg);
@@ -281,8 +274,7 @@ keypress(XEvent *e)
281} 274}
282 275
283static void 276static void
284leavenotify(XEvent *e) 277leavenotify(XEvent *e) {
285{
286 XCrossingEvent *ev = &e->xcrossing; 278 XCrossingEvent *ev = &e->xcrossing;
287 279
288 if((ev->window == root) && !ev->same_screen) { 280 if((ev->window == root) && !ev->same_screen) {
@@ -292,8 +284,7 @@ leavenotify(XEvent *e)
292} 284}
293 285
294static void 286static void
295mappingnotify(XEvent *e) 287mappingnotify(XEvent *e) {
296{
297 XMappingEvent *ev = &e->xmapping; 288 XMappingEvent *ev = &e->xmapping;
298 289
299 XRefreshKeyboardMapping(ev); 290 XRefreshKeyboardMapping(ev);
@@ -302,8 +293,7 @@ mappingnotify(XEvent *e)
302} 293}
303 294
304static void 295static void
305maprequest(XEvent *e) 296maprequest(XEvent *e) {
306{
307 static XWindowAttributes wa; 297 static XWindowAttributes wa;
308 XMapRequestEvent *ev = &e->xmaprequest; 298 XMapRequestEvent *ev = &e->xmaprequest;
309 299
@@ -321,8 +311,7 @@ maprequest(XEvent *e)
321} 311}
322 312
323static void 313static void
324propertynotify(XEvent *e) 314propertynotify(XEvent *e) {
325{
326 Client *c; 315 Client *c;
327 Window trans; 316 Window trans;
328 XPropertyEvent *ev = &e->xproperty; 317 XPropertyEvent *ev = &e->xproperty;
@@ -354,8 +343,7 @@ propertynotify(XEvent *e)
354} 343}
355 344
356static void 345static void
357unmapnotify(XEvent *e) 346unmapnotify(XEvent *e) {
358{
359 Client *c; 347 Client *c;
360 XUnmapEvent *ev = &e->xunmap; 348 XUnmapEvent *ev = &e->xunmap;
361 349
@@ -380,8 +368,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
380}; 368};
381 369
382void 370void
383grabkeys() 371grabkeys() {
384{
385 static unsigned int len = sizeof(key) / sizeof(key[0]); 372 static unsigned int len = sizeof(key) / sizeof(key[0]);
386 unsigned int i; 373 unsigned int i;
387 KeyCode code; 374 KeyCode code;
@@ -401,8 +388,7 @@ grabkeys()
401} 388}
402 389
403void 390void
404procevent() 391procevent() {
405{
406 XEvent ev; 392 XEvent ev;
407 393
408 while(XPending(dpy)) { 394 while(XPending(dpy)) {
@@ -411,4 +397,3 @@ procevent()
411 (handler[ev.type])(&ev); /* call handler */ 397 (handler[ev.type])(&ev); /* call handler */
412 } 398 }
413} 399}
414