wmii

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

commit 88d43166f6e0b8a5afdc1c967e04b48160c3694a
parent 1b2966fb386c3596742cd8b7473bd122d3e0c8c0
Author: Kris Maglione <jg@suckless.org>
Date:   Mon,  5 Feb 2007 04:38:32 -0500

Replaced XDrawLines with XDrawRectangles... let's see if anything breaks (+ some cleanups)


Diffstat:
draw.c | 21+++++----------------
frame.c | 25++++++++++++++-----------
wmii.h | 2+-
3 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/draw.c b/draw.c @@ -73,13 +73,13 @@ labelh(BlitzFont *font) { void draw_tile(BlitzBrush *b) { - drawbg(b->blitz->dpy, b->drawable, b->gc, b->rect, + drawbg(b->blitz->dpy, b->drawable, b->gc, &b->rect, b->color, True, b->border); } void draw_border(BlitzBrush *b) { - drawbg(b->blitz->dpy, b->drawable, b->gc, b->rect, + drawbg(b->blitz->dpy, b->drawable, b->gc, &b->rect, b->color, False, True); } @@ -137,29 +137,18 @@ draw_label(BlitzBrush *b, char *text) { } void -drawbg(Display *dpy, Drawable drawable, GC gc, XRectangle rect, +drawbg(Display *dpy, Drawable drawable, GC gc, XRectangle *rect, BlitzColor c, Bool fill, Bool border) { - XPoint points[5]; if(fill) { XSetForeground(dpy, gc, c.bg); - XFillRectangles(dpy, drawable, gc, &rect, 1); + XFillRectangles(dpy, drawable, gc, rect, 1); } if(!border) return; XSetLineAttributes(dpy, gc, 1, LineSolid, CapButt, JoinMiter); XSetForeground(dpy, gc, c.border); - points[0].x = rect.x; - points[0].y = rect.y; - points[1].x = rect.width - 1; - points[1].y = 0; - points[2].x = 0; - points[2].y = rect.height - 1; - points[3].x = -(rect.width - 1); - points[3].y = 0; - points[4].x = 0; - points[4].y = -(rect.height - 1); - XDrawLines(dpy, drawable, gc, points, 5, CoordModePrevious); + XDrawRectangles(dpy, drawable, gc, rect, 1); } void diff --git a/frame.c b/frame.c @@ -69,10 +69,10 @@ swap_frames(Frame *fa, Frame *fb) { if(fa == fb) return; a = fa->area; - for(fp_a = &a->frame; *fp_a; fp_a=&(*fp_a)->anext) + for(fp_a = &a->frame; *fp_a; fp_a = &(*fp_a)->anext) if(*fp_a == fa) break; a = fb->area; - for(fp_b = &a->frame; *fp_b; fp_b=&(*fp_b)->anext) + for(fp_b = &a->frame; *fp_b; fp_b = &(*fp_b)->anext) if(*fp_b == fb) break; if(fa->anext == fb) { @@ -146,18 +146,21 @@ draw_frames() { void check_frame_constraints(XRectangle *rect) { int max_height; - max_height = screen->rect.height - labelh(&def.font); + int barheight; + + barheight = screen->brect.height; + max_height = screen->rect.height - barheight; if(rect->height > max_height) rect->height = max_height; if(rect->width > screen->rect.width) rect->width = screen->rect.width; - if(rect->x + screen->brect.height > screen->rect.width) - rect->x = screen->rect.width - screen->brect.height; - if(rect->y + screen->brect.height > max_height) - rect->y = max_height - screen->brect.height; - if(rect->x + rect->width < screen->brect.height) - rect->x = screen->brect.height - rect->width; - if(rect->y + rect->height < screen->brect.height) - rect->y = screen->brect.height - rect->height; + if(rect->x + barheight > screen->rect.width) + rect->x = screen->rect.width - barheight; + if(rect->y + barheight > max_height) + rect->y = max_height - barheight; + if(rect->x + rect->width < barheight) + rect->x = barheight - rect->width; + if(rect->y + rect->height < barheight) + rect->y = barheight - rect->height; } diff --git a/wmii.h b/wmii.h @@ -301,7 +301,7 @@ extern void draw_tile(BlitzBrush *b); extern void draw_rect(BlitzBrush *b); extern void drawbg(Display *dpy, Drawable drawable, GC gc, - XRectangle rect, BlitzColor c, Bool fill, Bool border); + XRectangle *rect, BlitzColor c, Bool fill, Bool border); extern void drawcursor(Display *dpy, Drawable drawable, GC gc, int x, int y, unsigned int h, BlitzColor c); extern unsigned int textwidth(BlitzFont *font, char *text);