diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2009-07-14 16:26:04 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2009-07-14 16:26:04 +0100 |
| commit | 450b08dde2409846201175e226158ad4e2c61ea1 (patch) | |
| tree | 4dcd78b8f86c4b993c2e0af80d4afe90fb5469bc /dwm.c | |
| parent | removed int cast in TAGMASK as suggested by nsz (diff) | |
| download | dwm-450b08dde2409846201175e226158ad4e2c61ea1.tar.gz dwm-450b08dde2409846201175e226158ad4e2c61ea1.zip | |
final style fixes
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 28 |
1 files changed, 13 insertions, 15 deletions
| @@ -380,7 +380,6 @@ void | |||
| 380 | arrange(void) { | 380 | arrange(void) { |
| 381 | Monitor *m; | 381 | Monitor *m; |
| 382 | 382 | ||
| 383 | /* optimise two loops into one, check focus(NULL) */ | ||
| 384 | for(m = mons; m; m = m->next) | 383 | for(m = mons; m; m = m->next) |
| 385 | showhide(m->stack); | 384 | showhide(m->stack); |
| 386 | focus(NULL); | 385 | focus(NULL); |
| @@ -440,7 +439,7 @@ buttonpress(XEvent *e) { | |||
| 440 | } | 439 | } |
| 441 | for(i = 0; i < LENGTH(buttons); i++) | 440 | for(i = 0; i < LENGTH(buttons); i++) |
| 442 | if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button | 441 | if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button |
| 443 | && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) | 442 | && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) |
| 444 | buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); | 443 | buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); |
| 445 | } | 444 | } |
| 446 | 445 | ||
| @@ -885,7 +884,7 @@ getstate(Window w) { | |||
| 885 | Atom real; | 884 | Atom real; |
| 886 | 885 | ||
| 887 | status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], | 886 | status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], |
| 888 | &real, &format, &n, &extra, (unsigned char **)&p); | 887 | &real, &format, &n, &extra, (unsigned char **)&p); |
| 889 | if(status != Success) | 888 | if(status != Success) |
| 890 | return -1; | 889 | return -1; |
| 891 | if(n != 0) | 890 | if(n != 0) |
| @@ -909,9 +908,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) { | |||
| 909 | if(name.encoding == XA_STRING) | 908 | if(name.encoding == XA_STRING) |
| 910 | strncpy(text, (char *)name.value, size - 1); | 909 | strncpy(text, (char *)name.value, size - 1); |
| 911 | else { | 910 | else { |
| 912 | if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success | 911 | if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { |
| 913 | && n > 0 && *list) | ||
| 914 | { | ||
| 915 | strncpy(text, *list, size - 1); | 912 | strncpy(text, *list, size - 1); |
| 916 | XFreeStringList(list); | 913 | XFreeStringList(list); |
| 917 | } | 914 | } |
| @@ -1022,8 +1019,8 @@ keypress(XEvent *e) { | |||
| 1022 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | 1019 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
| 1023 | for(i = 0; i < LENGTH(keys); i++) | 1020 | for(i = 0; i < LENGTH(keys); i++) |
| 1024 | if(keysym == keys[i].keysym | 1021 | if(keysym == keys[i].keysym |
| 1025 | && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) | 1022 | && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) |
| 1026 | && keys[i].func) | 1023 | && keys[i].func) |
| 1027 | keys[i].func(&(keys[i].arg)); | 1024 | keys[i].func(&(keys[i].arg)); |
| 1028 | } | 1025 | } |
| 1029 | 1026 | ||
| @@ -1168,7 +1165,7 @@ movemouse(const Arg *arg) { | |||
| 1168 | nx = ocx + (ev.xmotion.x - x); | 1165 | nx = ocx + (ev.xmotion.x - x); |
| 1169 | ny = ocy + (ev.xmotion.y - y); | 1166 | ny = ocy + (ev.xmotion.y - y); |
| 1170 | if(snap && nx >= selmon->wx && nx <= selmon->wx + selmon->ww | 1167 | if(snap && nx >= selmon->wx && nx <= selmon->wx + selmon->ww |
| 1171 | && ny >= selmon->wy && ny <= selmon->wy + selmon->wh) { | 1168 | && ny >= selmon->wy && ny <= selmon->wy + selmon->wh) { |
| 1172 | if(abs(selmon->wx - nx) < snap) | 1169 | if(abs(selmon->wx - nx) < snap) |
| 1173 | nx = selmon->wx; | 1170 | nx = selmon->wx; |
| 1174 | else if(abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) | 1171 | else if(abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap) |
| @@ -1178,7 +1175,7 @@ movemouse(const Arg *arg) { | |||
| 1178 | else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) | 1175 | else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap) |
| 1179 | ny = selmon->wy + selmon->wh - HEIGHT(c); | 1176 | ny = selmon->wy + selmon->wh - HEIGHT(c); |
| 1180 | if(!c->isfloating && selmon->lt[selmon->sellt]->arrange | 1177 | if(!c->isfloating && selmon->lt[selmon->sellt]->arrange |
| 1181 | && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) | 1178 | && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
| 1182 | togglefloating(NULL); | 1179 | togglefloating(NULL); |
| 1183 | } | 1180 | } |
| 1184 | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) | 1181 | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) |
| @@ -1279,7 +1276,7 @@ resizemouse(const Arg *arg) { | |||
| 1279 | ocx = c->x; | 1276 | ocx = c->x; |
| 1280 | ocy = c->y; | 1277 | ocy = c->y; |
| 1281 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, | 1278 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
| 1282 | None, cursor[CurResize], CurrentTime) != GrabSuccess) | 1279 | None, cursor[CurResize], CurrentTime) != GrabSuccess) |
| 1283 | return; | 1280 | return; |
| 1284 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); | 1281 | XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); |
| 1285 | do { | 1282 | do { |
| @@ -1294,9 +1291,10 @@ resizemouse(const Arg *arg) { | |||
| 1294 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); | 1291 | nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
| 1295 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); | 1292 | nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
| 1296 | if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww | 1293 | if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww |
| 1297 | && nh >= selmon->wy && nh <= selmon->wy + selmon->wh) { | 1294 | && nh >= selmon->wy && nh <= selmon->wy + selmon->wh) |
| 1295 | { | ||
| 1298 | if(!c->isfloating && selmon->lt[selmon->sellt]->arrange | 1296 | if(!c->isfloating && selmon->lt[selmon->sellt]->arrange |
| 1299 | && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) | 1297 | && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) |
| 1300 | togglefloating(NULL); | 1298 | togglefloating(NULL); |
| 1301 | } | 1299 | } |
| 1302 | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) | 1300 | if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) |
| @@ -1473,8 +1471,8 @@ setup(void) { | |||
| 1473 | /* select for events */ | 1471 | /* select for events */ |
| 1474 | wa.cursor = cursor[CurNormal]; | 1472 | wa.cursor = cursor[CurNormal]; |
| 1475 | wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask | 1473 | wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask |
| 1476 | |EnterWindowMask|LeaveWindowMask|StructureNotifyMask | 1474 | |EnterWindowMask|LeaveWindowMask|StructureNotifyMask |
| 1477 | |PropertyChangeMask; | 1475 | |PropertyChangeMask; |
| 1478 | XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); | 1476 | XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); |
| 1479 | XSelectInput(dpy, root, wa.event_mask); | 1477 | XSelectInput(dpy, root, wa.event_mask); |
| 1480 | grabkeys(); | 1478 | grabkeys(); |
