summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 553194d..7a6b82f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -51,7 +51,7 @@
51#define MOUSEMASK (BUTTONMASK|PointerMotionMask) 51#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
52#define WIDTH(X) ((X)->w + 2 * (X)->bw) 52#define WIDTH(X) ((X)->w + 2 * (X)->bw)
53#define HEIGHT(X) ((X)->h + 2 * (X)->bw) 53#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
54#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) 54#define TAGMASK ((int)((1 << LENGTH(tags)) - 1))
55#define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height) 55#define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height)
56 56
57/* enums */ 57/* enums */
@@ -271,7 +271,7 @@ static Window root;
271#include "config.h" 271#include "config.h"
272 272
273/* compile-time check if all tags fit into an unsigned int bit array. */ 273/* compile-time check if all tags fit into an unsigned int bit array. */
274struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 : 1]; }; 274struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
275 275
276/* function implementations */ 276/* function implementations */
277void 277void
@@ -420,9 +420,9 @@ buttonpress(XEvent *e) {
420 } 420 }
421 if(ev->window == selmon->barwin) { 421 if(ev->window == selmon->barwin) {
422 i = x = 0; 422 i = x = 0;
423 do 423 do {
424 x += TEXTW(tags[i]); 424 x += TEXTW(tags[i]);
425 while(ev->x >= x && ++i < LENGTH(tags)); 425 } while(ev->x >= x && ++i < LENGTH(tags));
426 if(i < LENGTH(tags)) { 426 if(i < LENGTH(tags)) {
427 click = ClkTagBar; 427 click = ClkTagBar;
428 arg.ui = 1 << i; 428 arg.ui = 1 << i;
@@ -977,6 +977,7 @@ initfont(const char *fontstr) {
977 XFontSetExtents *font_extents; 977 XFontSetExtents *font_extents;
978 XFontStruct **xfonts; 978 XFontStruct **xfonts;
979 char **font_names; 979 char **font_names;
980
980 dc.font.ascent = dc.font.descent = 0; 981 dc.font.ascent = dc.font.descent = 0;
981 font_extents = XExtentsOfFontSet(dc.font.set); 982 font_extents = XExtentsOfFontSet(dc.font.set);
982 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); 983 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
@@ -1184,8 +1185,7 @@ movemouse(const Arg *arg) {
1184 resize(c, nx, ny, c->w, c->h, True); 1185 resize(c, nx, ny, c->w, c->h, True);
1185 break; 1186 break;
1186 } 1187 }
1187 } 1188 } while(ev.type != ButtonRelease);
1188 while(ev.type != ButtonRelease);
1189 XUngrabPointer(dpy, CurrentTime); 1189 XUngrabPointer(dpy, CurrentTime);
1190 if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) { 1190 if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) {
1191 sendmon(c, m); 1191 sendmon(c, m);
@@ -1303,8 +1303,7 @@ resizemouse(const Arg *arg) {
1303 resize(c, c->x, c->y, nw, nh, True); 1303 resize(c, c->x, c->y, nw, nh, True);
1304 break; 1304 break;
1305 } 1305 }
1306 } 1306 } while(ev.type != ButtonRelease);
1307 while(ev.type != ButtonRelease);
1308 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); 1307 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
1309 XUngrabPointer(dpy, CurrentTime); 1308 XUngrabPointer(dpy, CurrentTime);
1310 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 1309 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
@@ -1347,7 +1346,7 @@ run(void) {
1347 XSync(dpy, False); 1346 XSync(dpy, False);
1348 while(running && !XNextEvent(dpy, &ev)) 1347 while(running && !XNextEvent(dpy, &ev))
1349 if(handler[ev.type]) 1348 if(handler[ev.type])
1350 (handler[ev.type])(&ev); /* call handler */ 1349 handler[ev.type](&ev); /* call handler */
1351} 1350}
1352 1351
1353void 1352void