X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=de%2Fdraw.c;h=40a2f8ffe02d257af6847cbbe97152ba8947f306;hp=552e48f990bd00dc9b2eb79a27168a4e76fc6b62;hb=de22e45179cb3bafa490294d31d47f361047a30a;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/de/draw.c b/de/draw.c index 552e48f..40a2f8f 100644 --- a/de/draw.c +++ b/de/draw.c @@ -112,8 +112,8 @@ static void do_draw_border(Window win, GC gc, int x, int y, int w, int h, b=0; for(i=0; id->border); - GC gc=brush->d->normal_gc; - Window win=brush->win; - - switch(bd->style){ - case DEBORDER_RIDGE: - draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); - case DEBORDER_INLAID: - draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); - draw_border(win, gc, &geom, bd->sh, bd->hl, cg->sh, cg->hl); - break; - case DEBORDER_GROOVE: - draw_border(win, gc, &geom, bd->sh, bd->hl, cg->sh, cg->hl); - draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); - draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); - break; - case DEBORDER_ELEVATED: - default: - draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); - draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); - break; - } -} - - - - -void debrush_draw_border(DEBrush *brush, - const WRectangle *geom) -{ - DEColourGroup *cg=debrush_get_current_colour_group(brush); - if(cg!=NULL) - debrush_do_draw_border(brush, *geom, cg); -} - - static void draw_borderline(Window win, GC gc, WRectangle *geom, uint tl, uint br, DEColour tlc, DEColour brc, GrBorderLine line) { - if(line==GR_BORDERLINE_LEFT && geom->h>0){ + if(line==GR_BORDERLINE_LEFT && geom->h>0 && tl>0){ XSetForeground(ioncore_g.dpy, gc, tlc); - XDrawRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h); + XSetBackground(ioncore_g.dpy, gc, tlc); + XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, tl, geom->h); geom->x+=tl; - }else if(line==GR_BORDERLINE_TOP && geom->w>0){ + }else if(line==GR_BORDERLINE_TOP && geom->w>0 && tl>0){ XSetForeground(ioncore_g.dpy, gc, tlc); - XDrawRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl); + XSetBackground(ioncore_g.dpy, gc, tlc); + XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y, geom->w, tl); geom->y+=tl; - }else if(line==GR_BORDERLINE_RIGHT && geom->h>0){ + }else if(line==GR_BORDERLINE_RIGHT && geom->h>0 && br>0){ XSetForeground(ioncore_g.dpy, gc, brc); - XDrawRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-1-br, geom->y, br, geom->h); + XSetBackground(ioncore_g.dpy, gc, brc); + XFillRectangle(ioncore_g.dpy, win, gc, geom->x+geom->w-br, geom->y, br, geom->h); geom->w-=br; - }else if(line==GR_BORDERLINE_BOTTOM && geom->w>0){ + }else if(line==GR_BORDERLINE_BOTTOM && geom->w>0 && br>0){ XSetForeground(ioncore_g.dpy, gc, brc); - XDrawRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-1-br, geom->w, br); + XSetBackground(ioncore_g.dpy, gc, brc); + XFillRectangle(ioncore_g.dpy, win, gc, geom->x, geom->y+geom->h-br, geom->w, br); geom->h-=br; } } @@ -229,6 +194,17 @@ void debrush_do_draw_borderline(DEBrush *brush, WRectangle geom, } +void debrush_do_draw_padline(DEBrush *brush, WRectangle geom, + DEColourGroup *cg, GrBorderLine line) +{ + DEBorder *bd=&(brush->d->border); + GC gc=brush->d->normal_gc; + Window win=brush->win; + + draw_borderline(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad, line); +} + + void debrush_draw_borderline(DEBrush *brush, const WRectangle *geom, GrBorderLine line) { @@ -238,6 +214,68 @@ void debrush_draw_borderline(DEBrush *brush, const WRectangle *geom, } +static void debrush_do_do_draw_border(DEBrush *brush, WRectangle geom, + DEColourGroup *cg) +{ + DEBorder *bd=&(brush->d->border); + GC gc=brush->d->normal_gc; + Window win=brush->win; + + switch(bd->style){ + case DEBORDER_RIDGE: + draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); + case DEBORDER_INLAID: + draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); + draw_border(win, gc, &geom, bd->sh, bd->hl, cg->sh, cg->hl); + break; + case DEBORDER_GROOVE: + draw_border(win, gc, &geom, bd->sh, bd->hl, cg->sh, cg->hl); + draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); + draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); + break; + case DEBORDER_ELEVATED: + default: + draw_border(win, gc, &geom, bd->hl, bd->sh, cg->hl, cg->sh); + draw_border(win, gc, &geom, bd->pad, bd->pad, cg->pad, cg->pad); + break; + } +} + + +void debrush_do_draw_border(DEBrush *brush, WRectangle geom, + DEColourGroup *cg) +{ + DEBorder *bd=&(brush->d->border); + + switch(bd->sides){ + case DEBORDER_ALL: + debrush_do_do_draw_border(brush, geom, cg); + break; + case DEBORDER_TB: + debrush_do_draw_padline(brush, geom, cg, GR_BORDERLINE_LEFT); + debrush_do_draw_padline(brush, geom, cg, GR_BORDERLINE_RIGHT); + debrush_do_draw_borderline(brush, geom, cg, GR_BORDERLINE_TOP); + debrush_do_draw_borderline(brush, geom, cg, GR_BORDERLINE_BOTTOM); + break; + case DEBORDER_LR: + debrush_do_draw_padline(brush, geom, cg, GR_BORDERLINE_TOP); + debrush_do_draw_padline(brush, geom, cg, GR_BORDERLINE_BOTTOM); + debrush_do_draw_borderline(brush, geom, cg, GR_BORDERLINE_LEFT); + debrush_do_draw_borderline(brush, geom, cg, GR_BORDERLINE_RIGHT); + break; + } +} + + +void debrush_draw_border(DEBrush *brush, + const WRectangle *geom) +{ + DEColourGroup *cg=debrush_get_current_colour_group(brush); + if(cg!=NULL) + debrush_do_draw_border(brush, *geom, cg); +} + + /*}}}*/