[hackers] [wmii] Cleanup frame sizing and fix some long-standing bugs with borderless/titleless clients.

From: Kris Maglione <jg_AT_suckless.org>
Date: Sun Jan 27 03:17:53 2008

changeset: 2264:5571d2245926
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Jan 26 21:13:42 2008 -0500
summary: Cleanup frame sizing and fix some long-standing bugs with borderless/titleless clients.

diff -r 21841eb0db06 -r 5571d2245926 cmd/util.c
--- a/cmd/util.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/util.c Sat Jan 26 21:13:42 2008 -0500
@@ -79,9 +79,15 @@ sxprint(const char *fmt, ...) {
 }
 
 void
-_die(char *file, int line, char *msg) {
+_die(char *file, int line, char *msg, ...) {
+ va_list ap;
+
+ va_start(ap, msg);
         fprint(2, "%s: dieing at %s:%d: %s\n",
- argv0, file, line, msg);
+ argv0, file, line,
+ vsxprint(msg, ap));
+ va_end(ap);
+
         kill(getpid(), SIGABRT);
         abort(); /* Adds too many frames:
                   * _die()
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/bar.c Sat Jan 26 21:13:42 2008 -0500
@@ -122,7 +122,7 @@ bar_draw(WMScreen *s) {
         float shrink;
 
         largest = nil;
- tw = width = 0;
+ width = 0;
         foreach_bar(s, b) {
                 b->r.min = ZP;
                 b->r.max.y = Dy(s->brect);
@@ -141,13 +141,15 @@ bar_draw(WMScreen *s) {
                         *pb = b;
                 }
                 SET(shrink);
+ tw = 0;
                 for(tb=largest; tb; tb=tb->smaller) {
                         width -= Dx(tb->r);
                         tw += Dx(tb->r);
                         shrink = (Dx(s->brect) - width) / (float)tw;
- if(tb->smaller)
- if(Dx(tb->r) * shrink >= Dx(tb->smaller->r))
- break;
+ if(tb->smaller && Dx(tb->r) * shrink < Dx(tb->smaller->r))
+ continue;
+ if(width + (int)(tw * shrink) <= Dx(s->brect))
+ break;
                 }
                 if(tb)
                         for(b=largest; b != tb->smaller; b=b->smaller)
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/client.c
--- a/cmd/wmii/client.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/client.c Sat Jan 26 21:13:42 2008 -0500
@@ -180,7 +180,10 @@ client_manage(Client *c) {
         /* Maybe not the best idea... */
         if(!c->trans || !c->tags[0])
                 apply_rules(c);
- apply_tags(c, c->tags);
+ if(c->tags[0])
+ apply_tags(c, c->tags);
+ else
+ apply_tags(c, "sel");
 
         if(!starting)
                 view_update_all();
@@ -310,28 +313,30 @@ clientname(Client *c) {
 
 Rectangle
 client_grav(Client *c, Rectangle rd) {
- Rectangle r;
+ Rectangle r, cr;
         Point sp;
         WinHints *h;
 
         h = c->w.hints;
- sp = Pt(def.border, labelh(def.font));
 
         if(eqrect(rd, ZR)) {
                 if(c->sel) {
                         r = c->sel->floatr;
                 }else
- r = frame_client2rect(nil, c->r);
- r = gravitate(r, c->r, h->grav);
- if(h->gravstatic)
+ r = frame_client2rect(c, c->r, true);
+ cr = frame_rect2client(c, r, true);
+ sp = subpt(cr.min, r.min);
+ r = gravitate(r, cr, h->grav);
+ if(!h->gravstatic)
+ r = rectsubpt(r, sp);
+ return frame_rect2client(c, r, true);
+ }else {
+ r = frame_client2rect(c, rd, true);
+ sp = subpt(rd.min, r.min);
+ r = gravitate(rd, r, h->grav);
+ if(!h->gravstatic)
                         r = rectaddpt(r, sp);
- return frame_rect2client(nil, r);
- }else {
- r = frame_client2rect(nil, rd);
- r = gravitate(rd, r, h->grav);
- if(h->gravstatic)
- r = rectsubpt(r, sp);
- return frame_client2rect(nil, r);
+ return frame_client2rect(c, r, true);
         }
 }
 
@@ -364,9 +369,9 @@ frame_hints(Frame *f, Rectangle r, Align
                 return r;
 
         or = r;
- r = frame_rect2client(f, r);
+ r = frame_rect2client(c, r, f->area->floating);
         r = sizehint(c->w.hints, r);
- r = frame_client2rect(f, r);
+ r = frame_client2rect(c, r, f->area->floating);
 
         if(!f->area->floating) {
                 /* Not allowed to grow */
@@ -381,7 +386,6 @@ frame_hints(Frame *f, Rectangle r, Align
                 p.x = Dx(or) - Dx(r);
         if((sticky&(North|South)) == South)
                 p.y = Dy(or) - Dy(r);
-
         return rectaddpt(r, p);
 }
 
@@ -674,8 +678,9 @@ updatemwm(Client *c) {
         n = getprop_long(&c->w, "_MOTIF_WM_HINTS", "_MOTIF_WM_HINTS",
                         0L, (long**)&ret, 3L);
 
+ /* FIXME: Look over this. */
         if(c->sel)
- r = frame_rect2client(c->sel, c->sel->r);
+ r = frame_rect2client(c, c->sel->r, c->sel->area->floating);
 
         c->borderless = 0;
         c->titleless = 0;
@@ -688,7 +693,7 @@ updatemwm(Client *c) {
         free(ret);
 
         if(c->sel) {
- r = frame_client2rect(c->sel, r);
+ r = frame_client2rect(c, r, c->sel->area->floating);
                 client_resize(c, r);
                 frame_draw(c->sel);
         }
@@ -775,8 +780,7 @@ configreq_event(Window *w, XConfigureReq
                 client_resize(c, r);
                 sync();
                 flushenterevents();
- }
- else {
+ }else {
                 c->sel->floatr = r;
                 client_configure(c);
         }
@@ -1075,7 +1079,5 @@ apply_rules(Client *c) {
                                 apply_tags(c, r->value);
                                 break;
                         }
- if(c->tags[0] == '\0')
- apply_tags(c, "sel");
-}
-
+}
+
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/column.c
--- a/cmd/wmii/column.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/column.c Sat Jan 26 21:13:42 2008 -0500
@@ -248,6 +248,11 @@ column_scale(Area *a) {
                 }
         }
 
+ if(surplus < 0) {
+ print("Badness: surplus = %d\n", surplus);
+ surplus = 0;
+ }
+
         yoff = a->r.min.y;
         i = nuncol;
         for(f=a->frame; f; f=f->anext) {
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/fns.h Sat Jan 26 21:13:42 2008 -0500
@@ -124,9 +124,9 @@ int ingrabbox_p(Frame*, int x, int y);
 int ingrabbox_p(Frame*, int x, int y);
 void move_focus(Frame*, Frame*);
 Rectangle constrain(Rectangle);
-Rectangle frame_client2rect(Frame*, Rectangle);
+Rectangle frame_client2rect(Client*, Rectangle, bool);
+Rectangle frame_rect2client(Client*, Rectangle, bool);
 Rectangle frame_hints(Frame*, Rectangle, Align);
-Rectangle frame_rect2client(Frame*, Rectangle);
 
 /* fs.c */
 void fs_attach(Ixp9Req*);
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/frame.c Sat Jan 26 21:13:42 2008 -0500
@@ -29,9 +29,8 @@ frame_create(Client *c, View *v) {
         if(c->sel) {
                 f->floatr = c->sel->floatr;
                 f->r = c->sel->r;
- }
- else{
- f->r = frame_client2rect(f, client_grav(c, ZR));
+ }else{
+ f->r = frame_client2rect(c, client_grav(c, ZR), true);
                 f->floatr = f->r;
                 c->sel = f;
         }
@@ -243,58 +242,63 @@ Handlers framehandler = {
 
 /* These must die!!! */
 Rectangle
-frame_rect2client(Frame *f, Rectangle r) {
- if(f == nil || f->area == nil || f->area->floating) {
- r.max.x -= def.border * 2;
- r.max.y -= frame_delta_h();
- if(f) {
- if(f->client->borderless) {
- r.max.x += 2 * def.border;
- r.max.y += def.border;
- }
- if(f->client->titleless)
- r.max.y += labelh(def.font);
+frame_rect2client(Client *c, Rectangle r, bool floating) {
+
+ if(c->fullscreen)
+ return r;
+
+ if(!floating) {
+ r.min.x += 1;
+ r.min.y += labelh(def.font);
+ r.max.x -= 1;
+ r.max.y -= 1;
+ }else {
+ if(!c->borderless) {
+ r.min.x += def.border;
+ r.max.x -= def.border;
+ r.max.y -= def.border;
                 }
+ if(!c->titleless)
+ r.min.y += labelh(def.font);
+ }
+ r.max.x = max(r.max.x, r.min.x+1);
+ r.max.y = max(r.max.y, r.min.y+1);
+ return r;
+}
+
+Rectangle
+frame_client2rect(Client *c, Rectangle r, bool floating) {
+
+ if(c->fullscreen)
+ return r;
+
+ if(!floating) {
+ r.min.x -= 1;
+ r.min.y -= labelh(def.font);
+ r.max.x += 1;
+ r.max.y += 1;
         }else {
- r.max.x -= 2;
- r.max.y -= labelh(def.font) + 1;
- }
- r.max.x = max(r.min.x+1, r.max.x);
- r.max.y = max(r.min.y+1, r.max.y);
+ if(!c->borderless) {
+ r.min.x -= def.border;
+ r.max.x += def.border;
+ r.max.y += def.border;
+ }
+ if(!c->titleless)
+ r.min.y -= labelh(def.font);
+ }
         return r;
 }
 
-Rectangle
-frame_client2rect(Frame *f, Rectangle r) {
- if(f == nil || f->area == nil || f->area->floating) {
- r.max.x += def.border * 2;
- r.max.y += frame_delta_h();
- if(f) {
- if(f->client->borderless) {
- r.max.x -= 2 * def.border;
- r.max.y -= def.border;
- }
- if(f->client->titleless)
- r.max.y -= labelh(def.font);
- }
- }else {
- r.max.x += 2;
- r.max.y += labelh(def.font) + 1;
- }
- return r;
-}
-
-/* FIXME: This is getting entirely too long! */
 void
 frame_resize(Frame *f, Rectangle r) {
         Client *c;
- Rectangle cr;
- Point pt;
- Align stickycorner;
+ Rectangle fr, cr;
         int collapsed;
 
+ if(Dx(r) <= 0 || Dy(r) <= 0)
+ die("Frame rect: %R\n", r);
+
         c = f->client;
-
         if(c->fullscreen) {
                 f->crect = screen->r;
                 f->r = screen->r;
@@ -304,155 +308,44 @@ frame_resize(Frame *f, Rectangle r) {
         if(f->area->floating)
                 f->collapsed = false;
 
- stickycorner = get_sticky(f->r, r);
- f->crect = frame_hints(f, r, stickycorner);
-
- if(Dx(r) <= 0 || Dy(r) <= 0)
- fprint(2, "Badness: Frame rect: %R\n", r);
-
- if(f->area->floating)
- f->r = f->crect;
- else
- f->r = r;
-
- cr = frame_rect2client(f, f->crect);
- cr = rectsubpt(cr, cr.min);
-
+ fr = frame_hints(f, r, get_sticky(f->r, r));
+ if(f->area->floating && !c->strut)
+ fr = constrain(fr);
+
+ /* Collapse managed frames which are too small */
         collapsed = f->collapsed;
-
         if(!f->area->floating && f->area->mode == Coldefault) {
+ f->collapsed = false;
                 if(Dy(f->r) < 2 * labelh(def.font))
- f->collapsed = True;
- else
- f->collapsed = False;
- }
-
- if(Dx(cr) < labelh(def.font))
- f->r.max.x = f->r.min.x + frame_delta_h();
-
- if(f->collapsed) {
- f->r.max.y = f->r.min.y + labelh(def.font);
- cr = f->r;
- }
-
+ f->collapsed = true;
+ }
         if(collapsed != f->collapsed)
                 ewmh_updatestate(c);
 
- pt = ZP;
- if(!f->client->borderless || !f->area->floating)
- pt.y += 1;
- if(!f->client->titleless || !f->area->floating)
- pt.y += labelh(def.font) - 1;
-
- if(f->area->floating && !f->client->strut)
- f->r = constrain(f->r);
+ fr.max.x = max(fr.max.x, fr.min.x + 2*labelh(def.font));
+ if(f->collapsed)
+ fr.max.y = fr.min.y + labelh(def.font);
+
+ cr = frame_rect2client(c, fr, f->area->floating);
+ if(f->area->floating)
+ f->r = fr;
+ else {
+ cr.min.x += ((Dx(fr) - Dx(cr)) - 2 * (cr.min.x - fr.min.x))
+ / 2;
+ f->r = r;
+ }
+ f->crect = rectsubpt(cr, f->r.min);
 
         if(f->area->floating)
                 f->floatr = f->r;
         else
                 f->colr = f->r;
-
- pt.x = (Dx(f->r) - Dx(cr)) / 2;
- f->crect = rectaddpt(cr, pt);
-}
-
-void
-frame_setcursor(Frame *f, Point pt) {
- Rectangle r;
- Cursor cur;
-
- if(f->area->floating
- && !rect_haspoint_p(pt, f->titlebar)
- && !rect_haspoint_p(pt, f->crect)) {
- r = rectsubpt(f->r, f->r.min);
- cur = quad_cursor(quadrant(r, pt));
- client_setcursor(f->client, cur);
- } else
- client_setcursor(f->client, cursor[CurNormal]);
-}
-
-void
-frame_swap(Frame *fa, Frame *fb) {
- Frame **fp;
- Client *c;
-
- if(fa == fb) return;
-
- for(fp = &fa->client->frame; *fp; fp = &fp[0]->cnext)
- if(*fp == fa) break;
- fp[0] = fp[0]->cnext;
-
- for(fp = &fb->client->frame; *fp; fp = &fp[0]->cnext)
- if(*fp == fb) break;
- fp[0] = fp[0]->cnext;
-
- c = fa->client;
- fa->client = fb->client;
- fb->client = c;
- fb->cnext = c->frame;
- c->frame = fb;
-
- c = fa->client;
- fa->cnext = c->frame;
- c->frame = fa;
-
- if(c->sel && c->sel->view == screen->sel)
- view_focus(screen, c->sel->view);
-}
-
-void
-move_focus(Frame *old_f, Frame *f) {
- int noinput;
-
- noinput = (old_f && old_f->client->noinput) ||
- (f && f->client->noinput) ||
- screen->hasgrab != &c_root;
- if(noinput) {
- if(old_f)
- frame_draw(old_f);
- if(f)
- frame_draw(f);
- }
-}
-
-void
-frame_focus(Frame *f) {
- Client *c;
- Frame *old_f;
- View *v;
- Area *a, *old_a;
-
- c = f->client;
- v = f->view;
- a = f->area;
- old_a = v->sel;
-
- old_f = old_a->sel;
- a->sel = f;
-
- if(a != old_a)
- area_focus(f->area);
- if(old_a != v->oldsel && f != old_f)
- v->oldsel = nil;
-
- if(v != screen->sel || a != v->sel)
- return;
-
- move_focus(old_f, f);
- client_focus(f->client);
-
- if(!a->floating && ((a->mode == Colstack) || (a->mode == Colmax)))
- column_arrange(a, False);
-}
-
-int
-frame_delta_h(void) {
- return def.border + labelh(def.font);
 }
 
 void
 frame_draw(Frame *f) {
         Rectangle r, fr;
+ Client *c;
         CTuple *col;
         Frame *tf;
         uint w;
@@ -462,8 +355,10 @@ frame_draw(Frame *f) {
         if(f->area == nil) /* Blech. */
                 return;
 
- if(f->client == screen->focus
- || f->client == selclient())
+ c = f->client;
+
+ if(c == screen->focus
+ || c == selclient())
                 col = &def.focuscolor;
         else
                 col = &def.normcolor;
@@ -473,7 +368,7 @@ frame_draw(Frame *f) {
                                 col = &def.focuscolor;
                                 break;
                         }
- fr = f->client->framewin->r;
+ fr = c->framewin->r;
         fr = rectsubpt(fr, fr.min);
 
         /* background */
@@ -488,7 +383,7 @@ frame_draw(Frame *f) {
         f->titlebar.max.y += 3;
 
         /* Odd state of focus. */
- if(f->client != selclient() && col == &def.focuscolor)
+ if(c != selclient() && col == &def.focuscolor)
                 border(screen->ibuf, insetrect(r, 1),
                         1, def.normcolor.bg);
 
@@ -498,24 +393,28 @@ frame_draw(Frame *f) {
         r.max.y -= 2;
         f->grabbox = r;
 
- if(f->client->urgent)
+ if(c->urgent)
                 fill(screen->ibuf, r, col->fg);
         border(screen->ibuf, r, 1, col->border);
 
         /* Odd state of focus. */
- if(f->client != screen->focus && col == &def.focuscolor)
+ if(c != screen->focus && col == &def.focuscolor)
                 border(screen->ibuf, insetrect(r, -1),
                         1, def.normcolor.bg);
+ if(c->borderless && c->titleless && c == selclient())
+ setborder(c->framewin, def.border, def.focuscolor.border);
+ else
+ setborder(c->framewin, 0, 0);
 
         /* Label */
         r.min.x = r.max.x;
         r.max.x = fr.max.x;
         r.min.y = 0;
         r.max.y = labelh(def.font);
- if(f->client->floating)
+ if(c->floating)
                 r.max.x -= Dx(f->grabbox);
         w = drawstring(screen->ibuf, def.font, r, West,
- f->client->name, col->fg);
+ c->name, col->fg);
 
         if(f->area->floating) {
                 r.min.x = r.min.x + w + 10;
@@ -538,9 +437,9 @@ frame_draw(Frame *f) {
          * What's more, the designers of X11 felt that it would be unfair to
          * implementers to make it possible to detect, or forbid, such changes.
          */
- XSetWindowBackgroundPixmap(display, f->client->framewin->w, None);
-
- copyimage(f->client->framewin, fr, screen->ibuf, ZP);
+ XSetWindowBackgroundPixmap(display, c->framewin->w, None);
+
+ copyimage(c->framewin, fr, screen->ibuf, ZP);
         sync();
 }
 
@@ -551,6 +450,100 @@ frame_draw_all(void) {
         for(c=client; c; c=c->next)
                 if(c->sel && c->sel->view == screen->sel)
                         frame_draw(c->sel);
+}
+
+void
+frame_setcursor(Frame *f, Point pt) {
+ Rectangle r;
+ Cursor cur;
+
+ if(f->area->floating
+ && !rect_haspoint_p(pt, f->titlebar)
+ && !rect_haspoint_p(pt, f->crect)) {
+ r = rectsubpt(f->r, f->r.min);
+ cur = quad_cursor(quadrant(r, pt));
+ client_setcursor(f->client, cur);
+ } else
+ client_setcursor(f->client, cursor[CurNormal]);
+}
+
+void
+frame_swap(Frame *fa, Frame *fb) {
+ Frame **fp;
+ Client *c;
+
+ if(fa == fb) return;
+
+ for(fp = &fa->client->frame; *fp; fp = &fp[0]->cnext)
+ if(*fp == fa) break;
+ fp[0] = fp[0]->cnext;
+
+ for(fp = &fb->client->frame; *fp; fp = &fp[0]->cnext)
+ if(*fp == fb) break;
+ fp[0] = fp[0]->cnext;
+
+ c = fa->client;
+ fa->client = fb->client;
+ fb->client = c;
+ fb->cnext = c->frame;
+ c->frame = fb;
+
+ c = fa->client;
+ fa->cnext = c->frame;
+ c->frame = fa;
+
+ if(c->sel && c->sel->view == screen->sel)
+ view_focus(screen, c->sel->view);
+}
+
+void
+move_focus(Frame *old_f, Frame *f) {
+ int noinput;
+
+ noinput = (old_f && old_f->client->noinput) ||
+ (f && f->client->noinput) ||
+ screen->hasgrab != &c_root;
+ if(noinput) {
+ if(old_f)
+ frame_draw(old_f);
+ if(f)
+ frame_draw(f);
+ }
+}
+
+void
+frame_focus(Frame *f) {
+ Client *c;
+ Frame *old_f;
+ View *v;
+ Area *a, *old_a;
+
+ c = f->client;
+ v = f->view;
+ a = f->area;
+ old_a = v->sel;
+
+ old_f = old_a->sel;
+ a->sel = f;
+
+ if(a != old_a)
+ area_focus(f->area);
+ if(old_a != v->oldsel && f != old_f)
+ v->oldsel = nil;
+
+ if(v != screen->sel || a != v->sel)
+ return;
+
+ move_focus(old_f, f);
+ client_focus(f->client);
+
+ if(!a->floating && ((a->mode == Colstack) || (a->mode == Colmax)))
+ column_arrange(a, False);
+}
+
+int
+frame_delta_h(void) {
+ return def.border + labelh(def.font);
 }
 
 Rectangle
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/main.c
--- a/cmd/wmii/main.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/main.c Sat Jan 26 21:13:42 2008 -0500
@@ -241,7 +241,6 @@ errorhandler(Display *dpy, XErrorEvent *
         /* Try to cleanup, but only try once, in case we're called recursively. */
         if(!dead++)
                 cleanup();
- abort();
         return xlib_errorhandler(display, error); /* calls exit() */
 }
 
diff -r 21841eb0db06 -r 5571d2245926 cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Sat Jan 26 10:03:06 2008 -0500
+++ b/cmd/wmii/x11.c Sat Jan 26 21:13:42 2008 -0500
@@ -243,6 +243,7 @@ window(XWindow xw) {
 
 void
 reparentwindow(Window *w, Window *par, Point p) {
+ assert(w->type == WWindow);
         XReparentWindow(display, w->w, par->w, p.x, p.y);
         w->parent = par;
         w->r = rectsubpt(w->r, w->r.min);
@@ -266,11 +267,31 @@ setwinattr(Window *w, WinAttr *wa, int v
 }
 
 void
+setborder(Window *w, int width, long pixel) {
+ Rectangle r;
+
+ assert(w->type == WWindow);
+ if(width)
+ XSetWindowBorder(display, w->w, pixel);
+ if(w->border != width) {
+ w->border = width;
+ XSetWindowBorderWidth(display, w->w, width);
+ /* FIXME: Kludge */
+ r = w->r;
+ w->r = ZR;
+ reshapewin(w, r);
+ }
+}
+
+void
 reshapewin(Window *w, Rectangle r) {
         assert(w->type == WWindow);
- if(!eqrect(r, w->r))
+ assert(Dx(r) > 0 && Dy(r) > 0); /* Rather than an X error. */
+ if(!eqrect(r, w->r)) {
+ w->r = r;
+ r = rectsubpt(r, Pt(w->border, w->border));
                 XMoveResizeWindow(display, w->w, r.min.x, r.min.y, Dx(r), Dy(r));
- w->r = r;
+ }
 }
 
 void
@@ -278,13 +299,13 @@ movewin(Window *w, Point pt) {
         Rectangle r;
 
         assert(w->type == WWindow);
- r = rectsubpt(w->r, w->r.min);
- r = rectaddpt(r, pt);
+ r = rectsetorigin(w->r, pt);
         reshapewin(w, r);
 }
 
 int
 mapwin(Window *w) {
+ assert(w->type == WWindow);
         if(!w->mapped) {
                 XMapWindow(display, w->w);
                 w->mapped = 1;
@@ -295,6 +316,7 @@ mapwin(Window *w) {
 
 int
 unmapwin(Window *w) {
+ assert(w->type == WWindow);
         if(w->mapped) {
                 XUnmapWindow(display, w->w);
                 w->mapped = 0;
@@ -306,11 +328,13 @@ unmapwin(Window *w) {
 
 void
 raisewin(Window *w) {
+ assert(w->type == WWindow);
         XRaiseWindow(display, w->w);
 }
 
 void
 lowerwin(Window *w) {
+ assert(w->type == WWindow);
         XLowerWindow(display, w->w);
 }
 
diff -r 21841eb0db06 -r 5571d2245926 include/util.h
--- a/include/util.h Sat Jan 26 10:03:06 2008 -0500
+++ b/include/util.h Sat Jan 26 21:13:42 2008 -0500
@@ -28,7 +28,7 @@ typedef long long vlong;
 
 #define strlcat wmii_strlcat
 /* util.c */
-void _die(char*, int, char*);
+void _die(char*, int, char*, ...);
 void* emalloc(uint);
 void* emallocz(uint);
 void* erealloc(void*, uint);
@@ -43,8 +43,8 @@ int utflcpy(char*, const char*, int);
 int utflcpy(char*, const char*, int);
 char* vsxprint(const char*, va_list);
 
-#define die(x) \
- _die(__FILE__, __LINE__, x)
+#define die(...) \
+ _die(__FILE__, __LINE__, __VA_ARGS__)
 
 char *argv0;
 #undef ARGBEGIN
diff -r 21841eb0db06 -r 5571d2245926 include/x11.h
--- a/include/x11.h Sat Jan 26 10:03:06 2008 -0500
+++ b/include/x11.h Sat Jan 26 21:13:42 2008 -0500
@@ -115,6 +115,7 @@ struct Window {
         XID w;
         GC gc;
         Rectangle r;
+ int border;
         Window* parent;
         Window* next;
         Window* prev;
@@ -218,6 +219,7 @@ void reparentwindow(Window*, Window*, Po
 void reparentwindow(Window*, Window*, Point);
 void reshapewin(Window*, Rectangle);
 void sendevent(Window*, bool propegate, long mask, XEvent*);
+void setborder(Window*, int, long);
 void setfocus(Window*, int mode);
 void sethints(Window*);
 void setshapemask(Window *dst, Image *src, Point);
diff -r 21841eb0db06 -r 5571d2245926 mk/dir.mk
--- a/mk/dir.mk Sat Jan 26 10:03:06 2008 -0500
+++ b/mk/dir.mk Sat Jan 26 21:13:42 2008 -0500
@@ -1,10 +1,10 @@ MKSUBDIR = targ=$@; \
-MKSUBDIR = targ=$@; \
+MKSUBDIR = targ=$@; targ=$${targ\#d}; \
         for i in $$dirs; do \
                 if [ ! -d $$i ]; then \
                         echo Skipping nonexistent directory: $$i 1>&2; \
                 else \
- echo MAKE $${targ\#d} $(BASE)$$i/; \
- (cd $$i && $(MAKE) BASE="$(BASE)$$i/" $${targ\#d}) || exit $?; \
+ echo MAKE $$targ $(BASE)$$i/; \
+ (cd $$i && $(MAKE) BASE="$(BASE)$$i/" $$targ) || exit $?; \
                 fi; \
         done
 
diff -r 21841eb0db06 -r 5571d2245926 mk/hdr.mk
--- a/mk/hdr.mk Sat Jan 26 10:03:06 2008 -0500
+++ b/mk/hdr.mk Sat Jan 26 21:13:42 2008 -0500
@@ -21,7 +21,7 @@ all:
 
 .c.depend:
         echo MKDEP $<
- $(MKDEP) $(CFLAGS) $< >>.depend
+ $(MKDEP) $(EXCFLAGS) $(CFLAGS) $< >>.depend
 
 .sh.depend .rc.depend .1.depend .awk.depend:
         :
@@ -82,9 +82,11 @@ all:
         rm -f $(MAN)/man1/$<
 
 .O.clean:
+ echo CLEAN $$($(CLEANNAME) $(BASE)$<)
         rm -f $< || true 2>/dev/null
         rm -f $*.o || true 2>/dev/null
 .o.clean .o_pic.clean:
+ echo CLEAN $$($(CLEANNAME) $(BASE)$<)
         rm -f $< || true 2>/dev/null
 
 printinstall:
diff -r 21841eb0db06 -r 5571d2245926 mk/many.mk
--- a/mk/many.mk Sat Jan 26 10:03:06 2008 -0500
+++ b/mk/many.mk Sat Jan 26 21:13:42 2008 -0500
@@ -13,6 +13,7 @@ printinstall:
 
 manyclean:
         for i in ${TARG:=.o} ${TARG:=.O} $(OFILES); do \
+ echo CLEAN $$($(CLEANNAME) $(BASE)$$i); \
                 rm -f $$i; \
         done 2>/dev/null || true
 
diff -r 21841eb0db06 -r 5571d2245926 mk/one.mk
--- a/mk/one.mk Sat Jan 26 10:03:06 2008 -0500
+++ b/mk/one.mk Sat Jan 26 21:13:42 2008 -0500
@@ -14,6 +14,7 @@ printinstall:
 
 oneclean:
         for i in $(PROG) $(OFILES); do \
+ echo CLEAN $$($(CLEANNAME) $(BASE)$$i); \
                 rm -f $$i; \
         done 2>/dev/null || true
 
Received on Sun Jan 27 2008 - 03:17:53 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:11 UTC