mirror of
https://github.com/0intro/wmii
synced 2024-11-22 05:42:05 +03:00
Allow alpha colors in the bar.
This commit is contained in:
parent
94eeb058d9
commit
63d4079b8a
@ -11,16 +11,11 @@ static Handlers handlers;
|
|||||||
for((b)=(s)->bar[__bar_n]; (b); (b)=(b)->next)
|
for((b)=(s)->bar[__bar_n]; (b); (b)=(b)->next)
|
||||||
|
|
||||||
void
|
void
|
||||||
bar_init(WMScreen *s, bool force) {
|
bar_init(WMScreen *s) {
|
||||||
WinAttr wa;
|
WinAttr wa;
|
||||||
|
|
||||||
if(s->barwin)
|
if(s->barwin && (s->barwin->depth == 32) == s->barwin_rgba)
|
||||||
if(force)
|
return;
|
||||||
destroywindow(s->barwin);
|
|
||||||
else {
|
|
||||||
bar_resize(s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->brect = s->r;
|
s->brect = s->r;
|
||||||
s->brect.min.y = s->brect.max.y - labelh(def.font);
|
s->brect.min.y = s->brect.max.y - labelh(def.font);
|
||||||
@ -182,12 +177,12 @@ bar_draw(WMScreen *s) {
|
|||||||
width += tw * shrink;
|
width += tw * shrink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(s->bar[BRight])
|
||||||
|
s->bar[BRight]->r.max.x += Dx(s->brect) - width;
|
||||||
tb = nil;
|
tb = nil;
|
||||||
foreach_bar(s, b) {
|
foreach_bar(s, b) {
|
||||||
if(tb)
|
if(tb)
|
||||||
b->r = rectaddpt(b->r, Pt(tb->r.max.x, 0));
|
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;
|
tb = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +201,7 @@ bar_draw(WMScreen *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(s->barwin_rgba != (s->barwin->depth == 32))
|
if(s->barwin_rgba != (s->barwin->depth == 32))
|
||||||
bar_init(s, true);
|
bar_init(s);
|
||||||
copyimage(s->barwin, r, ibuf, ZP);
|
copyimage(s->barwin, r, ibuf, ZP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ Bar* bar_create(Bar**, const char*);
|
|||||||
void bar_destroy(Bar**, Bar*);
|
void bar_destroy(Bar**, Bar*);
|
||||||
void bar_draw(WMScreen*);
|
void bar_draw(WMScreen*);
|
||||||
Bar* bar_find(Bar*, const char*);
|
Bar* bar_find(Bar*, const char*);
|
||||||
void bar_init(WMScreen*, bool);
|
void bar_init(WMScreen*);
|
||||||
void bar_resize(WMScreen*);
|
void bar_resize(WMScreen*);
|
||||||
void bar_sety(WMScreen*, int);
|
void bar_sety(WMScreen*, int);
|
||||||
void bar_setbounds(WMScreen*, int, int);
|
void bar_setbounds(WMScreen*, int, int);
|
||||||
|
@ -210,7 +210,7 @@ init_screens(void) {
|
|||||||
for(v=view; v; v=v->next)
|
for(v=view; v; v=v->next)
|
||||||
view_init(v, i);
|
view_init(v, i);
|
||||||
def.snap = Dy(screen->r) / 63;
|
def.snap = Dy(screen->r) / 63;
|
||||||
bar_init(screens[i], false);
|
bar_init(screens[i]);
|
||||||
}
|
}
|
||||||
screen = screens[0];
|
screen = screens[0];
|
||||||
if(selview)
|
if(selview)
|
||||||
|
@ -10,16 +10,15 @@ void
|
|||||||
root_init(void) {
|
root_init(void) {
|
||||||
WinAttr wa;
|
WinAttr wa;
|
||||||
|
|
||||||
|
wa.cursor = cursor[CurNormal];
|
||||||
wa.event_mask = EnterWindowMask
|
wa.event_mask = EnterWindowMask
|
||||||
| FocusChangeMask
|
| FocusChangeMask
|
||||||
| LeaveWindowMask
|
| LeaveWindowMask
|
||||||
| PointerMotionMask
|
| PointerMotionMask
|
||||||
| SubstructureNotifyMask
|
| SubstructureNotifyMask
|
||||||
| SubstructureRedirectMask;
|
| SubstructureRedirectMask;
|
||||||
wa.cursor = cursor[CurNormal];
|
setwinattr(&scr.root, &wa, CWCursor
|
||||||
setwinattr(&scr.root, &wa,
|
| CWEventMask);
|
||||||
CWEventMask
|
|
||||||
| CWCursor);
|
|
||||||
sethandler(&scr.root, &handlers);
|
sethandler(&scr.root, &handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,16 +49,8 @@ static bool
|
|||||||
mapreq_event(Window *w, void *aux, XMapRequestEvent *e) {
|
mapreq_event(Window *w, void *aux, XMapRequestEvent *e) {
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
|
|
||||||
if(!XGetWindowAttributes(display, e->window, &wa))
|
if(!XGetWindowAttributes(display, e->window, &wa) || wa.override_redirect)
|
||||||
return false;
|
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))
|
if(!win2client(e->window))
|
||||||
client_create(e->window, &wa);
|
client_create(e->window, &wa);
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,7 +22,7 @@ static int
|
|||||||
Lfmt(Fmt *f) {
|
Lfmt(Fmt *f) {
|
||||||
Color c;
|
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);
|
c = va_arg(f->args, Color);
|
||||||
return fmtprint(f, c.alpha < 0xff00 ? "rgba:%02uhx/%02uhx/%02uhx/%02uhx"
|
return fmtprint(f, c.alpha < 0xff00 ? "rgba:%02uhx/%02uhx/%02uhx/%02uhx"
|
||||||
: "#%02uhx%02uhx%02uhx",
|
: "#%02uhx%02uhx%02uhx",
|
||||||
|
Loading…
Reference in New Issue
Block a user