Allow alpha colors in the bar.

This commit is contained in:
Kris Maglione 2010-07-19 09:30:52 -04:00
parent 94eeb058d9
commit 63d4079b8a
5 changed files with 13 additions and 27 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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",