39 #ifdef XINERAMA |
39 #ifdef XINERAMA |
40 #include <X11/extensions/Xinerama.h> |
40 #include <X11/extensions/Xinerama.h> |
41 #endif /* XINERAMA */ |
41 #endif /* XINERAMA */ |
42 |
42 |
43 /* macros */ |
43 /* macros */ |
|
44 #define D if(1) |
44 #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) |
45 #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) |
45 #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) |
46 #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) |
46 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) |
47 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) |
47 #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) |
48 #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) |
48 #define LENGTH(X) (sizeof X / sizeof X[0]) |
49 #define LENGTH(X) (sizeof X / sizeof X[0]) |
1386 } |
1387 } |
1387 |
1388 |
1388 void |
1389 void |
1389 run(void) { |
1390 run(void) { |
1390 XEvent ev; |
1391 XEvent ev; |
1391 |
1392 static const char *evname[LASTEvent] = { |
|
1393 [ButtonPress] = "buttonpress", |
|
1394 [ConfigureRequest] = "configurerequest", |
|
1395 [ConfigureNotify] = "configurenotify", |
|
1396 [DestroyNotify] = "destroynotify", |
|
1397 [EnterNotify] = "enternotify", |
|
1398 [Expose] = "expose", |
|
1399 [FocusIn] = "focusin", |
|
1400 [KeyPress] = "keypress", |
|
1401 [MappingNotify] = "mappingnotify", |
|
1402 [MapRequest] = "maprequest", |
|
1403 [PropertyNotify] = "propertynotify", |
|
1404 [UnmapNotify] = "unmapnotify" |
|
1405 }; |
1392 /* main event loop */ |
1406 /* main event loop */ |
1393 XSync(dpy, False); |
1407 XSync(dpy, False); |
1394 while(running && !XNextEvent(dpy, &ev)) |
1408 while(running && !XNextEvent(dpy, &ev)) { |
|
1409 D fprintf(stderr, "run event %s\n", evname[ev.type]); |
1395 if(handler[ev.type]) |
1410 if(handler[ev.type]) |
1396 handler[ev.type](&ev); /* call handler */ |
1411 handler[ev.type](&ev); /* call handler */ |
|
1412 } |
1397 } |
1413 } |
1398 |
1414 |
1399 void |
1415 void |
1400 scan(void) { |
1416 scan(void) { |
1401 unsigned int i, num; |
1417 unsigned int i, num; |