wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 38509b577b03ff3ed8eff90147dc0201f36154cd
parent 03eb032fc4ae897b3fc39a38157885162d27da44
Author: Kris Maglione <jg@suckless.org>
Date:   Wed, 28 Jan 2009 18:31:08 -0500

Formatting fixes.

Diffstat:
cmd/wmii/_util.c | 4++--
cmd/wmii/area.c | 2+-
cmd/wmii/bar.c | 2+-
cmd/wmii/client.c | 19+++++++++++--------
cmd/wmii/column.c | 5+++--
cmd/wmii/div.c | 3++-
cmd/wmii/event.c | 49+++++++++++++++++++++++++------------------------
cmd/wmii/frame.c | 8+++++---
cmd/wmii/fs.c | 22++++++++++++----------
cmd/wmii/geom.c | 4++--
cmd/wmii/main.c | 14+++++++-------
cmd/wmii/mouse.c | 35++++++++++++++++++-----------------
cmd/wmii/root.c | 2+-
cmd/wmii/view.c | 15++++++++++-----
cmd/wmii/x11.c | 34+++++++++++++++++++++++-----------
15 files changed, 123 insertions(+), 95 deletions(-)

diff --git a/cmd/wmii/_util.c b/cmd/wmii/_util.c @@ -17,13 +17,13 @@ void \ vector_##c##init(Vector_##nam *v) { \ memset(v, 0, sizeof *v); \ } \ - \ + \ void \ vector_##c##free(Vector_##nam *v) { \ free(v->ary); \ memset(v, 0, sizeof *v); \ } \ - \ + \ void \ vector_##c##push(Vector_##nam *v, type val) { \ if(v->n == v->size) { \ diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c @@ -7,7 +7,7 @@ #include "fns.h" Client* -area_selclient(Area *a) { +area_selclient(Area *a) { if(a && a->sel) return a->sel->client; return nil; diff --git a/cmd/wmii/bar.c b/cmd/wmii/bar.c @@ -136,7 +136,7 @@ bar_draw(WMScreen *s) { foreach_bar(s, b) { for(pb=&largest; *pb; pb=&pb[0]->smaller) if(Dx(pb[0]->r) < Dx(b->r)) - break; + break; b->smaller = *pb; *pb = b; } diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c @@ -231,8 +231,9 @@ client_manage(Client *c) { bool newgroup = !c->group || c->group->ref == 1 || selclient() && (selclient()->group == c->group) - || group_leader(c->group) && !client_viewframe(group_leader(c->group), - c->sel->view); + || group_leader(c->group) + && !client_viewframe(group_leader(c->group), + c->sel->view); f = c->sel; if(!(c->w.ewmh.type & TypeSplash)) @@ -302,14 +303,14 @@ client_destroy(Client *c) { /* Convenience functions */ Frame* -client_viewframe(Client *c, View *v) { +client_viewframe(Client *c, View *v) { Frame *f; for(f=c->frame; f; f=f->cnext) if(f->view == v) break; return f; -} +} Client* selclient(void) { @@ -378,7 +379,7 @@ client_grav(Client *c, Rectangle rd) { bool client_floats_p(Client *c) { return c->trans - || c->floating + || c->floating || c->fixedsize || c->titleless || c->borderless @@ -612,7 +613,8 @@ fullscreen(Client *c, int fullscreen) { } else if(f->oldarea > 0) { wassel = (f == f->area->sel); - area_moveto(view_findarea(f->view, f->oldarea, true), f); + area_moveto(view_findarea(f->view, f->oldarea, true), + f); if(wassel) frame_focus(f); } @@ -653,7 +655,8 @@ client_seturgent(Client *c, bool urgent, int from) { for(ff=a->frame; ff; ff=ff->anext) if(ff->client->urgent) break; if(urgent || ff == nil) - event("%sUrgentTag %s %s\n", cnot, cfrom, f->view->name); + event("%sUrgentTag %s %s\n", + cnot, cfrom, f->view->name); } } } @@ -1080,7 +1083,7 @@ apply_tags(Client *c, const char *tags) { } j = 0; - while(buf[n] && n < sizeof(buf) && j < 32) { + while(buf[n] && n < sizeof(buf) && j < 32) { /* Check for regex. */ if(buf[n] == '/') { for(i=n+1; i < sizeof(buf) - 1; i++) diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c @@ -504,7 +504,7 @@ comp_frame(const void *a, const void *b) { static void column_squeeze(Area *a) { - static Vector_ptr fvec; + static Vector_ptr fvec; Frame *f; int surplus, osurplus, dy, i; @@ -611,7 +611,8 @@ column_arrange(Area *a, bool dirty) { f->collapsed = (f != a->sel); break; default: - fprint(2, "Dieing: %s: screen: %d a: %p mode: %x floating: %d\n", v->name, a->screen, a, a->mode, a->floating); + fprint(2, "Dieing: %s: screen: %d a: %p mode: %x floating: %d\n", + v->name, a->screen, a, a->mode, a->floating); die("not reached"); break; } diff --git a/cmd/wmii/div.c b/cmd/wmii/div.c @@ -27,7 +27,8 @@ getdiv(Divide ***dp) { | EnterWindowMask | ButtonPressMask | ButtonReleaseMask; - d->w = createwindow(&scr.root, Rect(0, 0, 1, 1), scr.depth, InputOutput, &wa, + d->w = createwindow(&scr.root, Rect(0, 0, 1, 1), scr.depth, + InputOutput, &wa, CWOverrideRedirect | CWEventMask | CWCursor); diff --git a/cmd/wmii/event.c b/cmd/wmii/event.c @@ -22,31 +22,31 @@ dispatch_event(XEvent *e) { static int findtime(Display *d, XEvent *e, XPointer v) { - Window *w; - - w = (Window*)v; - if(e->type == PropertyNotify && e->xproperty.window == w->w) { - xtime = e->xproperty.time; - return true; - } - return false; + Window *w; + + w = (Window*)v; + if(e->type == PropertyNotify && e->xproperty.window == w->w) { + xtime = e->xproperty.time; + return true; + } + return false; } void xtime_kludge(void) { /* Round trip. */ - static Window *w; - WinAttr wa; - XEvent e; - long l; + static Window *w; + WinAttr wa; + XEvent e; + long l; if(w == nil) { w = createwindow(&scr.root, Rect(0, 0, 1, 1), 0, InputOnly, &wa, 0); selectinput(w, PropertyChangeMask); } - changeprop_long(w, "ATOM", "ATOM", &l, 0); + changeprop_long(w, "ATOM", "ATOM", &l, 0); sync(); - XIfEvent(display, &e, findtime, (void*)w); + XIfEvent(display, &e, findtime, (void*)w); } uint @@ -154,12 +154,13 @@ destroynotify(XDestroyWindowEvent *ev) { Window *w; Client *c; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, destroy, ev); else { if((c = win2client(ev->window))) fprint(2, "Badness: Unhandled DestroyNotify: " - "Client: %p, Window: %W, Name: %s\n", c, &c->w, c->name); + "Client: %p, Window: %W, Name: %s\n", + c, &c->w, c->name); } } @@ -171,7 +172,7 @@ enternotify(XCrossingEvent *ev) { if(ev->mode != NotifyNormal) return; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, enter, ev); } @@ -180,7 +181,7 @@ leavenotify(XCrossingEvent *ev) { Window *w; xtime = ev->time; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, leave, ev); } @@ -217,7 +218,7 @@ focusin(XFocusChangeEvent *ev) { print_focus("focusin", nil, "<nil>"); disp.focus = nil; } - else if((w = findwin(ev->window))) + else if((w = findwin(ev->window))) handle(w, focusin, ev); else if(ev->mode == NotifyGrab) { /* Some unmanaged window has grabbed focus */ @@ -247,7 +248,7 @@ focusout(XFocusChangeEvent *ev) { if((ev->mode == NotifyGrab) && XCheckMaskEvent(display, KeyPressMask, &me)) dispatch_event(&me); - else if((w = findwin(ev->window))) + else if((w = findwin(ev->window))) handle(w, focusout, ev); } @@ -256,7 +257,7 @@ expose(XExposeEvent *ev) { Window *w; if(ev->count == 0) - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, expose, ev); } @@ -265,7 +266,7 @@ keypress(XKeyEvent *ev) { Window *w; xtime = ev->time; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, kdown, ev); } @@ -299,7 +300,7 @@ propertynotify(XPropertyEvent *ev) { Window *w; xtime = ev->time; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, property, ev); } @@ -308,7 +309,7 @@ mapnotify(XMapEvent *ev) { Window *w; ignoreenter = ev->serial; - if((w = findwin(ev->window))) + if((w = findwin(ev->window))) handle(w, map, ev); } diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c @@ -212,7 +212,8 @@ enter_event(Window *w, XCrossingEvent *e) { f = c->sel; if(disp.focus != c || selclient() != c) { Dprint(DFocus, "enter_notify(f) => [%C]%s%s\n", - f->client, f->client->name, ignoreenter == e->serial ? " (ignored)" : ""); + f->client, f->client->name, + ignoreenter == e->serial ? " (ignored)" : ""); if(e->detail != NotifyInferior) if(e->serial != ignoreenter && (f->area->floating || !f->collapsed)) if(!(c->w.ewmh.type & TypeSplash)) @@ -300,7 +301,7 @@ frame_gethints(Frame *f) { #define ADJ(PE, ME) \ if(c->fullscreen >= 0) \ return r; \ - \ + \ if(!floating) { \ r.min.x PE 1; \ r.min.y PE labelh(def.font); \ @@ -344,7 +345,8 @@ frame_resize(Frame *f, Rectangle r) { int collapsed, dx; if(btassert("8 full", Dx(r) <= 0 || Dy(r) < 0 - || Dy(r) == 0 && (!f->area->max || resizing) && !f->collapsed)) { + || Dy(r) == 0 && (!f->area->max || resizing) + && !f->collapsed)) { fprint(2, "Frame rect: %R\n", r); r.max.x = min(r.min.x+1, r.max.x); r.max.y = min(r.min.y+1, r.max.y); diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c @@ -77,7 +77,7 @@ Ixp9Srv p9srv = { }; /* ad-hoc file tree. Empty names ("") indicate dynamic entries to be filled - * in by lookup_file + * in by lookup_file */ static IxpDirtab dirtab_root[]= {{".", QTDIR, FsRoot, 0500|DMDIR }, @@ -87,10 +87,10 @@ dirtab_root[]= {{".", QTDIR, FsRoot, 0500|DMDIR }, {"client", QTDIR, FsDClients, 0500|DMDIR }, {"tag", QTDIR, FsDTags, 0500|DMDIR }, {"ctl", QTAPPEND, FsFRctl, 0600|DMAPPEND }, - {"colrules", QTFILE, FsFColRules, 0600 }, + {"colrules", QTFILE, FsFColRules, 0600 }, {"event", QTFILE, FsFEvent, 0600 }, {"keys", QTFILE, FsFKeys, 0600 }, - {"tagrules", QTFILE, FsFTagRules, 0600 }, + {"tagrules", QTFILE, FsFTagRules, 0600 }, {nil}}, dirtab_clients[]={{".", QTDIR, FsDClients, 0500|DMDIR }, {"", QTDIR, FsDClient, 0500|DMDIR }, @@ -232,11 +232,11 @@ lookup_file(IxpFileId *parent, char *name) last = &ret; ret = nil; for(; dir->name; dir++) { -# define push_file(nam) \ - file = ixp_srv_getfile(); \ - *last = file; \ - last = &file->next; \ - file->tab = *dir; \ +# define push_file(nam) \ + file = ixp_srv_getfile(); \ + *last = file; \ + last = &file->next; \ + file->tab = *dir; \ file->tab.name = estrdup(nam) /* Dynamic dirs */ if(dir->name[0] == '\0') { @@ -483,7 +483,7 @@ fs_read(Ixp9Req *r) { return; } } - /* + /* * This is an assert because this should this should not be called if * the file is not open for reading. */ @@ -521,7 +521,9 @@ fs_write(Ixp9Req *r) { return; case FsFClabel: ixp_srv_data2cstring(r); - utfecpy(f->p.client->name, f->p.client->name+sizeof(client->name), r->ifcall.io.data); + utfecpy(f->p.client->name, + f->p.client->name+sizeof(client->name), + r->ifcall.io.data); frame_draw(f->p.client->sel); update_class(f->p.client); r->ofcall.io.count = r->ifcall.io.count; diff --git a/cmd/wmii/geom.c b/cmd/wmii/geom.c @@ -66,7 +66,7 @@ quad_cursor(Align align) { case SWest: return cursor[CurSWCorner]; case South: case North: return cursor[CurDVArrow]; - case East: + case East: case West: return cursor[CurDHArrow]; default: return cursor[CurMove]; } @@ -86,7 +86,7 @@ get_sticky(Rectangle src, Rectangle dst) { if(src.min.y != dst.min.y && src.max.y == dst.max.y) corner |= South; - else + else corner |= North; return corner; diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c @@ -159,12 +159,12 @@ init_screens(void) { int i, n, m; #ifdef notdef - d.x = Dx(scr.rect) - Dx(screen->r); - d.y = Dy(scr.rect) - Dy(screen->r); - for(v=view; v; v=v->next) { - v->r.max.x += d.x; - v->r.max.y += d.y; - } + d.x = Dx(scr.rect) - Dx(screen->r); + d.y = Dy(scr.rect) - Dy(screen->r); + for(v=view; v; v=v->next) { + v->r.max.x += d.x; + v->r.max.y += d.y; + } #endif /* Reallocate screens, zero any new ones. */ @@ -215,7 +215,7 @@ init_screens(void) { static void cleanup(void) { - while(client) + while(client) client_destroy(client); ixp_server_close(&srv); close(sleeperfd); diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c @@ -99,22 +99,22 @@ rect_morph(Rectangle *r, Point d, Align *mask) { /* Yes, yes, macros are evil. So are patterns. */ #define frob(x, y) \ - Rectangle *rp; \ - int i, tx; \ - \ - for(i=0; i < nrect; i++) { \ - rp = &rects[i]; \ - if((rp->min.y <= r->max.y) && (rp->max.y >= r->min.y)) { \ - tx = rp->min.x; \ - if(abs(tx - x) <= abs(dx)) \ - dx = tx - x; \ - \ - tx = rp->max.x; \ - if(abs(tx - x) <= abs(dx)) \ - dx = tx - x; \ - } \ - } \ - return dx \ + Rectangle *rp; \ + int i, tx; \ + \ + for(i=0; i < nrect; i++) { \ + rp = &rects[i]; \ + if((rp->min.y <= r->max.y) && (rp->max.y >= r->min.y)) { \ + tx = rp->min.x; \ + if(abs(tx - x) <= abs(dx)) \ + dx = tx - x; \ + \ + tx = rp->max.x; \ + if(abs(tx - x) <= abs(dx)) \ + dx = tx - x; \ + } \ + } \ + return dx \ static int snap_hline(Rectangle *rects, int nrect, int dx, Rectangle *r, int y) { @@ -598,7 +598,8 @@ mouse_checkresize(Frame *f, Point p, bool exec) { if(f->aprev && p.y <= 2 || f->anext && r.max.y - p.y <= 2) { cur = cursor[CurDVArrow]; - if(exec) mouse_tempvertresize(f->area, addpt(p, f->r.min)); + if(exec) + mouse_tempvertresize(f->area, addpt(p, f->r.min)); } } diff --git a/cmd/wmii/root.c b/cmd/wmii/root.c @@ -68,7 +68,7 @@ motion_event(Window *w, XMotionEvent *e) { r = rectsetorigin(Rect(0, 0, 1, 1), Pt(e->x_root, e->y_root)); r2 = constrain(r, 0); if(!eqrect(r, r2)) - warppointer(r2.min); + warppointer(r2.min); } static void diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c @@ -362,7 +362,8 @@ view_attach(View *v, Frame *f) { * last focused frame didn't float. Important when * tagging with +foo. */ - else if(starting || c->sel && c->sel->area && !c->sel->area->floating) + else if(starting + || c->sel && c->sel->area && !c->sel->area->floating) a = v->firstarea; } if(!a->floating && view_fullscreen_p(v, a->screen)) @@ -372,11 +373,15 @@ view_attach(View *v, Frame *f) { /* TODO: Decide whether to focus this frame */ bool newgroup = !c->group || c->group->ref == 1 - || view_selclient(v) && (view_selclient(v)->group == c->group) - || group_leader(c->group) && !client_viewframe(group_leader(c->group), - c->sel->view); + || view_selclient(v) + && view_selclient(v)->group == c->group + || group_leader(c->group) + && !client_viewframe(group_leader(c->group), + c->sel->view); + if(!(c->w.ewmh.type & (TypeSplash|TypeDock))) { - if(newgroup && !(c->tagre.regex && regexec(c->tagre.regc, v->name, nil, 0))) + if(newgroup + && !(c->tagre.regex && regexec(c->tagre.regc, v->name, nil, 0))) frame_focus(f); else if(c->group && f->area->sel->client->group == c->group) /* XXX: Stack. */ diff --git a/cmd/wmii/x11.c b/cmd/wmii/x11.c @@ -174,7 +174,9 @@ initdisplay(void) { scr.black = BlackPixel(display, scr.screen); scr.root.w = RootWindow(display, scr.screen); - scr.root.r = Rect(0, 0, DisplayWidth(display, scr.screen), DisplayHeight(display, scr.screen)); + scr.root.r = Rect(0, 0, + DisplayWidth(display, scr.screen), + DisplayHeight(display, scr.screen)); scr.rect = scr.root.r; scr.root.parent = &scr.root; @@ -258,7 +260,9 @@ freeimage(Image *img) { /* Windows */ Window* -createwindow_visual(Window *parent, Rectangle r, int depth, Visual *vis, uint class, WinAttr *wa, int valmask) { +createwindow_visual(Window *parent, Rectangle r, + int depth, Visual *vis, uint class, + WinAttr *wa, int valmask) { Window *w; assert(parent->type == WWindow); @@ -562,7 +566,7 @@ drawstring(Image *dst, Font *font, setgccol(dst, col); if(font->set) - Xutf8DrawString(display, dst->w, + Xutf8DrawString(display, dst->w, font->set, dst->gc, x, y, buf, len); @@ -740,8 +744,10 @@ delproperty(Window *w, char *prop) { } void -changeproperty(Window *w, char *prop, char *type, int width, uchar data[], int n) { - XChangeProperty(display, w->w, xatom(prop), xatom(type), width, PropModeReplace, data, n); +changeproperty(Window *w, char *prop, char *type, + int width, uchar data[], int n) { + XChangeProperty(display, w->w, xatom(prop), xatom(type), width, + PropModeReplace, data, n); } void @@ -794,7 +800,8 @@ freestringlist(char *list[]) { } static ulong -getprop(Window *w, char *prop, char *type, Atom *actual, int *format, ulong offset, uchar **ret, ulong length) { +getprop(Window *w, char *prop, char *type, Atom *actual, int *format, + ulong offset, uchar **ret, ulong length) { Atom typea; ulong n, extra; int status; @@ -817,14 +824,16 @@ getprop(Window *w, char *prop, char *type, Atom *actual, int *format, ulong offs } ulong -getproperty(Window *w, char *prop, char *type, Atom *actual, ulong offset, uchar **ret, ulong length) { +getproperty(Window *w, char *prop, char *type, Atom *actual, + ulong offset, uchar **ret, ulong length) { int format; return getprop(w, prop, type, actual, &format, offset, ret, length); } ulong -getprop_long(Window *w, char *prop, char *type, ulong offset, long **ret, ulong length) { +getprop_long(Window *w, char *prop, char *type, + ulong offset, long **ret, ulong length) { Atom actual; ulong n; int format; @@ -838,7 +847,8 @@ getprop_long(Window *w, char *prop, char *type, ulong offset, long **ret, ulong } ulong -getprop_ulong(Window *w, char *prop, char *type, ulong offset, ulong **ret, ulong length) { +getprop_ulong(Window *w, char *prop, char *type, + ulong offset, ulong **ret, ulong length) { return getprop_long(w, prop, type, offset, (long**)ret, length); } @@ -941,7 +951,8 @@ pointerscreen(void) { uint ui; int i; - return XQueryPointer(display, scr.root.w, &win, &win, &i, &i, &pt.x, &pt.y, &ui); + return XQueryPointer(display, scr.root.w, &win, &win, &i, &i, + &pt.x, &pt.y, &ui); } void @@ -968,7 +979,8 @@ translate(Window *src, Window *dst, Point sp) { Point pt; XWindow w; - XTranslateCoordinates(display, src->w, dst->w, sp.x, sp.y, &pt.x, &pt.y, &w); + XTranslateCoordinates(display, src->w, dst->w, sp.x, sp.y, + &pt.x, &pt.y, &w); return pt; }