commit 63d4079b8a326d43e70ad72dd219860fcb586354
parent 94eeb058d9a313cace8f18a8a071a76d9f6b64f5
Author: Kris Maglione <kris@suckless.org>
Date: Mon, 19 Jul 2010 09:30:52 -0400
Allow alpha colors in the bar.
Diffstat:
5 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/cmd/wmii/bar.c b/cmd/wmii/bar.c
@@ -11,16 +11,11 @@ static Handlers handlers;
for((b)=(s)->bar[__bar_n]; (b); (b)=(b)->next)
void
-bar_init(WMScreen *s, bool force) {
+bar_init(WMScreen *s) {
WinAttr wa;
- if(s->barwin)
- if(force)
- destroywindow(s->barwin);
- else {
- bar_resize(s);
- return;
- }
+ if(s->barwin && (s->barwin->depth == 32) == s->barwin_rgba)
+ return;
s->brect = s->r;
s->brect.min.y = s->brect.max.y - labelh(def.font);
@@ -182,12 +177,12 @@ bar_draw(WMScreen *s) {
width += tw * shrink;
}
+ if(s->bar[BRight])
+ s->bar[BRight]->r.max.x += Dx(s->brect) - width;
tb = nil;
foreach_bar(s, b) {
if(tb)
b->r = rectaddpt(b->r, Pt(tb->r.max.x, 0));
- if(b == s->bar[BRight])
- b->r.max.x += Dx(s->brect) - width;
tb = b;
}
@@ -206,7 +201,7 @@ bar_draw(WMScreen *s) {
}
if(s->barwin_rgba != (s->barwin->depth == 32))
- bar_init(s, true);
+ bar_init(s);
copyimage(s->barwin, r, ibuf, ZP);
}
diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h
@@ -68,7 +68,7 @@ Bar* bar_create(Bar**, const char*);
void bar_destroy(Bar**, Bar*);
void bar_draw(WMScreen*);
Bar* bar_find(Bar*, const char*);
-void bar_init(WMScreen*, bool);
+void bar_init(WMScreen*);
void bar_resize(WMScreen*);
void bar_sety(WMScreen*, int);
void bar_setbounds(WMScreen*, int, int);
diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c
@@ -210,7 +210,7 @@ init_screens(void) {
for(v=view; v; v=v->next)
view_init(v, i);
def.snap = Dy(screen->r) / 63;
- bar_init(screens[i], false);
+ bar_init(screens[i]);
}
screen = screens[0];
if(selview)
diff --git a/cmd/wmii/root.c b/cmd/wmii/root.c
@@ -10,16 +10,15 @@ void
root_init(void) {
WinAttr wa;
+ wa.cursor = cursor[CurNormal];
wa.event_mask = EnterWindowMask
| FocusChangeMask
| LeaveWindowMask
| PointerMotionMask
| SubstructureNotifyMask
| SubstructureRedirectMask;
- wa.cursor = cursor[CurNormal];
- setwinattr(&scr.root, &wa,
- CWEventMask
- | CWCursor);
+ setwinattr(&scr.root, &wa, CWCursor
+ | CWEventMask);
sethandler(&scr.root, &handlers);
}
@@ -50,16 +49,8 @@ static bool
mapreq_event(Window *w, void *aux, XMapRequestEvent *e) {
XWindowAttributes wa;
- if(!XGetWindowAttributes(display, e->window, &wa))
+ if(!XGetWindowAttributes(display, e->window, &wa) || wa.override_redirect)
return false;
- if(wa.override_redirect) {
- /* Do I really want these? */
- /* Probably not.
- XSelectInput(display, e->window,
- PropertyChangeMask | StructureNotifyMask);
- */
- return false;
- }
if(!win2client(e->window))
client_create(e->window, &wa);
return false;
diff --git a/lib/libstuff/x11/initdisplay.c b/lib/libstuff/x11/initdisplay.c
@@ -22,7 +22,7 @@ static int
Lfmt(Fmt *f) {
Color c;
-#define fix(c, m) (ushort)((c.alpha ? ((ulong)c.m * 0xffff) / c.alpha : 0) >> 8)
+#define fix(c, m) (ushort)((c.alpha ? (ulong)c.m * 0xffff / c.alpha : 0) >> 8)
c = va_arg(f->args, Color);
return fmtprint(f, c.alpha < 0xff00 ? "rgba:%02uhx/%02uhx/%02uhx/%02uhx"
: "#%02uhx%02uhx%02uhx",