wmii

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

commit 72029737b5a9719f3b34f28370c57718a594108d
parent a01daeff2d6deda97497e0ac6744a40422abce11
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Fri, 10 Mar 2006 18:35:00 +0100

removed meters (they have too limited use)


Diffstat:
cmd/wm/bar.c | 17+++++++----------
cmd/wm/event.c | 4++--
cmd/wm/mouse.c | 2+-
cmd/wm/wm.c | 12++++++------
cmd/wm/wm.h | 8++++----
liblitz/blitz.h | 6------
liblitz/draw.c | 27---------------------------
7 files changed, 20 insertions(+), 56 deletions(-)

diff --git a/cmd/wm/bar.c b/cmd/wm/bar.c @@ -56,10 +56,10 @@ update_bar_geometry() brect = rect; brect.height = bar_height(); brect.y = rect.height - brect.height; - XMoveResizeWindow(dpy, winbar, brect.x, brect.y, brect.width, brect.height); + XMoveResizeWindow(dpy, barwin, brect.x, brect.y, brect.width, brect.height); XSync(dpy, False); - XFreePixmap(dpy, pmapbar); - pmapbar = XCreatePixmap(dpy, winbar, brect.width, brect.height, DefaultDepth(dpy, screen)); + XFreePixmap(dpy, barpmap); + barpmap = XCreatePixmap(dpy, barwin, brect.width, brect.height, DefaultDepth(dpy, screen)); XSync(dpy, False); draw_bar(); for(i = 0; i < ntag; i++) @@ -81,8 +81,8 @@ draw_bar() iexp = label2index(exp); d.align = WEST; - d.gc = gcbar; - d.drawable = pmapbar; + d.gc = bargc; + d.drawable = barpmap; d.rect = brect; d.rect.y = 0; d.font = xfont; @@ -129,14 +129,11 @@ draw_bar() d.color = label[i]->color; d.rect = label[i]->rect; d.data = label[i]->data; - if(d.data && !strncmp(d.data, "%m:", 3)) - blitz_drawmeter(dpy, &d); - else - blitz_drawlabel(dpy, &d); + blitz_drawlabel(dpy, &d); blitz_drawborder(dpy, &d); } } - XCopyArea(dpy, pmapbar, winbar, gcbar, 0, 0, brect.width, brect.height, 0, 0); + XCopyArea(dpy, barpmap, barwin, bargc, 0, 0, brect.width, brect.height, 0, 0); XSync(dpy, False); } diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -62,7 +62,7 @@ handle_buttonpress(XEvent *e) XButtonPressedEvent *ev = &e->xbutton; Align align; static char buf[32]; - if(ev->window == winbar) { + if(ev->window == barwin) { unsigned int i; for(i = 0; i < nlabel; i++) if(blitz_ispointinrect(ev->x, ev->y, &label[i]->rect)) { @@ -192,7 +192,7 @@ handle_expose(XEvent *e) XExposeEvent *ev = &e->xexpose; static Client *c; if(ev->count == 0) { - if(ev->window == winbar) + if(ev->window == barwin) draw_bar(); else if((c = win2clientframe(ev->window))) draw_client(c); diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -289,7 +289,7 @@ draw_pseudo_border(XRectangle * r) pseudo.y += 2; pseudo.width -= 4; pseudo.height -= 4; - XDrawRectangles(dpy, root, gc_xor, &pseudo, 1); + XDrawRectangles(dpy, root, xorgc, &pseudo, 1); XSync(dpy, False); } diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -163,7 +163,7 @@ init_screen() gcv.line_width = 4; gcv.plane_mask = AllPlanes; gcv.graphics_exposures = False; - gc_xor = XCreateGC(dpy, root, GCForeground | GCGraphicsExposures + xorgc = XCreateGC(dpy, root, GCForeground | GCGraphicsExposures | GCFunction | GCSubwindowMode | GCLineWidth | GCPlaneMask, &gcv); rect.x = rect.y = 0; @@ -342,19 +342,19 @@ main(int argc, char *argv[]) brect = rect; brect.height = xfont->ascent + xfont->descent + 4; brect.y = rect.height - brect.height; - winbar = XCreateWindow(dpy, RootWindow(dpy, screen), brect.x, brect.y, + barwin = XCreateWindow(dpy, RootWindow(dpy, screen), brect.x, brect.y, brect.width, brect.height, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - XDefineCursor(dpy, winbar, XCreateFontCursor(dpy, XC_left_ptr)); + XDefineCursor(dpy, barwin, XCreateFontCursor(dpy, XC_left_ptr)); XSync(dpy, False); - gcbar = XCreateGC(dpy, winbar, 0, 0); + bargc = XCreateGC(dpy, barwin, 0, 0); - pmapbar = XCreatePixmap(dpy, winbar, brect.width, brect.height, + barpmap = XCreatePixmap(dpy, barwin, brect.width, brect.height, DefaultDepth(dpy, screen)); - XMapRaised(dpy, winbar); + XMapRaised(dpy, barwin); draw_bar(); scan_wins(); diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -193,11 +193,11 @@ int screen; Window root; XRectangle rect; XFontStruct *xfont; -GC gc_xor; +GC xorgc; IXPServer srv; -Pixmap pmapbar; -Window winbar; -GC gcbar; +Pixmap barpmap; +Window barwin; +GC bargc; XRectangle brect; Qid root_qid; diff --git a/liblitz/blitz.h b/liblitz/blitz.h @@ -32,16 +32,10 @@ typedef struct { char *data; } Draw; -typedef struct { - XImage* image; - Pixmap mask; -} Icon; - /* draw.c */ XFontStruct *blitz_getfont(Display *dpy, char *fontstr); int blitz_loadcolor(Display *dpy, int mon, char *colstr, Color *c); void blitz_drawlabel(Display *dpy, Draw *r); -void blitz_drawmeter(Display *dpy, Draw *r); void blitz_drawborder(Display *dpy, Draw *r); /* geometry.c */ diff --git a/liblitz/draw.c b/liblitz/draw.c @@ -137,38 +137,11 @@ xdrawtext(Display *dpy, Draw *d) break; } XSetBackground(dpy, d->gc, d->color.bg); - /* - * uncomment, if you want get an shadow effect XSetForeground(dpy, - * d->gc, BlackPixel(dpy, DefaultScreen(dpy))); XDrawString(dpy, - * d->drawable, d->gc, x + 1, y + 1, text, len); - */ XSetForeground(dpy, d->gc, d->color.fg); XDrawString(dpy, d->drawable, d->gc, x, y, text, len); } void -blitz_drawmeter(Display * dpy, Draw * d) -{ - const char *err; - unsigned int offy, mh, val, w = d->rect.width - 4; - - if (!d->data || strncmp(d->data, "%m:", 3)) - return; - - val = cext_strtonum(&d->data[3], 0, 100, &err); - if(err) - val = 100; - xdrawbg(dpy, d); - blitz_drawborder(dpy, d); - - /* draw bg gradient */ - mh = ((d->rect.height - 4) * val) / 100; - offy = d->rect.y + d->rect.height - 2 - mh; - XSetForeground(dpy, d->gc, d->color.fg); - XFillRectangle(dpy, d->drawable, d->gc, d->rect.x + 2, offy, w, mh); -} - -void blitz_drawlabel(Display *dpy, Draw * d) { xdrawbg(dpy, d);