made for/if/else constructs more consistent, some code polishing

pull/1/head
Anselm R. Garbe 18 years ago
parent 64cfebc5e7
commit e256afe31e
  1. 4
      client.c
  2. 10
      event.c
  3. 11
      main.c
  4. 3
      tag.c
  5. 3
      view.c

@ -304,8 +304,8 @@ updatesizehints(Client *c) {
} }
else else
c->minax = c->minay = c->maxax = c->maxay = 0; c->minax = c->minay = c->maxax = c->maxay = 0;
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh && c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
c->maxw == c->minw && c->maxh == c->minh); && c->maxw == c->minw && c->maxh == c->minh);
} }
void void

@ -156,8 +156,8 @@ buttonpress(XEvent *e) {
} }
else if(ev->button == Button2) else if(ev->button == Button2)
zoom(NULL); zoom(NULL);
else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) else if(ev->button == Button3
&& !c->isfixed) && (arrange == dofloat || c->isfloat) && !c->isfixed)
{ {
restack(); restack();
resizemouse(c); resizemouse(c);
@ -184,7 +184,8 @@ configurerequest(XEvent *e) {
c->w = ev->width; c->w = ev->width;
if(ev->value_mask & CWHeight) if(ev->value_mask & CWHeight)
c->h = ev->height; c->h = ev->height;
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight))) if((ev->value_mask & (CWX | CWY))
&& !(ev->value_mask & (CWWidth | CWHeight)))
configure(c); configure(c);
resize(c, False); resize(c, False);
if(!isvisible(c)) if(!isvisible(c))
@ -249,14 +250,13 @@ keypress(XEvent *e) {
XKeyEvent *ev = &e->xkey; XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++) { for(i = 0; i < len; i++)
if(keysym == key[i].keysym if(keysym == key[i].keysym
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) && CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
{ {
if(key[i].func) if(key[i].func)
key[i].func(&key[i].arg); key[i].func(&key[i].arg);
} }
}
} }
static void static void

@ -69,9 +69,8 @@ scan(void) {
wins = NULL; wins = NULL;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) { for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa)) if(!XGetWindowAttributes(dpy, wins[i], &wa)
continue; || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
continue; continue;
if(wa.map_state == IsViewable) if(wa.map_state == IsViewable)
manage(wins[i], &wa); manage(wins[i], &wa);
@ -104,12 +103,12 @@ setup(void) {
/* init modifier map */ /* init modifier map */
numlockmask = 0; numlockmask = 0;
modmap = XGetModifierMapping(dpy); modmap = XGetModifierMapping(dpy);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++)
for (j = 0; j < modmap->max_keypermod; j++) { for (j = 0; j < modmap->max_keypermod; j++) {
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) if(modmap->modifiermap[i * modmap->max_keypermod + j]
== XKeysymToKeycode(dpy, XK_Num_Lock))
numlockmask = (1 << i); numlockmask = (1 << i);
} }
}
XFreeModifiermap(modmap); XFreeModifiermap(modmap);
/* select for events */ /* select for events */
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask

@ -78,10 +78,9 @@ settags(Client *c, Client *trans) {
Bool matched = trans != NULL; Bool matched = trans != NULL;
XClassHint ch = { 0 }; XClassHint ch = { 0 };
if(matched) { if(matched)
for(i = 0; i < ntags; i++) for(i = 0; i < ntags; i++)
c->tags[i] = trans->tags[i]; c->tags[i] = trans->tags[i];
}
else { else {
XGetClassHint(dpy, c->win, &ch); XGetClassHint(dpy, c->win, &ch);
snprintf(prop, sizeof prop, "%s:%s:%s", snprintf(prop, sizeof prop, "%s:%s:%s",

@ -55,9 +55,8 @@ dofloat(void) {
Client *c; Client *c;
for(c = clients; c; c = c->next) { for(c = clients; c; c = c->next) {
if(isvisible(c)) { if(isvisible(c))
resize(c, True); resize(c, True);
}
else else
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
} }

Loading…
Cancel
Save