additional line width argument to draw_rectangle[_gradient] in draw.c
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
de5d82b8c2
commit
b92a292e43
|
@ -441,11 +441,11 @@ redraw(void)
|
||||||
{
|
{
|
||||||
geometry.x = prompt_len;
|
geometry.x = prompt_len;
|
||||||
geometry.width = x_of_previous_item - prompt_len;
|
geometry.width = x_of_previous_item - prompt_len;
|
||||||
draw_rectangle(globalconf.ctx, geometry, True, globalconf.styles.normal.bg);
|
draw_rectangle(globalconf.ctx, geometry, 1.0, True, globalconf.styles.normal.bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(geometry.width)
|
else if(geometry.width)
|
||||||
draw_rectangle(globalconf.ctx, geometry, True, globalconf.styles.normal.bg);
|
draw_rectangle(globalconf.ctx, geometry, 1.0, True, globalconf.styles.normal.bg);
|
||||||
|
|
||||||
simplewindow_refresh_drawable(globalconf.sw, DefaultScreen(globalconf.display));
|
simplewindow_refresh_drawable(globalconf.sw, DefaultScreen(globalconf.display));
|
||||||
XSync(globalconf.display, False);
|
XSync(globalconf.display, False);
|
||||||
|
|
|
@ -203,7 +203,7 @@ draw_text(DrawCtx *ctx,
|
||||||
ssize_t len, olen;
|
ssize_t len, olen;
|
||||||
char *buf = NULL, *utf8 = NULL;
|
char *buf = NULL, *utf8 = NULL;
|
||||||
|
|
||||||
draw_rectangle(ctx, area, True, style.bg);
|
draw_rectangle(ctx, area, 1.0, True, style.bg);
|
||||||
|
|
||||||
if(!(len = olen = a_strlen(text)))
|
if(!(len = olen = a_strlen(text)))
|
||||||
return;
|
return;
|
||||||
|
@ -324,14 +324,15 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
|
||||||
/** Draw rectangle
|
/** Draw rectangle
|
||||||
* \param ctx Draw context
|
* \param ctx Draw context
|
||||||
* \param geometry geometry
|
* \param geometry geometry
|
||||||
|
* \param line_width line width
|
||||||
* \param filled fill rectangle?
|
* \param filled fill rectangle?
|
||||||
* \param color color to use
|
* \param color color to use
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
|
draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, Bool filled, XColor color)
|
||||||
{
|
{
|
||||||
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
|
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
|
||||||
cairo_set_line_width(ctx->cr, 1.0);
|
cairo_set_line_width(ctx->cr, line_width);
|
||||||
cairo_set_source_rgb(ctx->cr,
|
cairo_set_source_rgb(ctx->cr,
|
||||||
color.red / 65535.0,
|
color.red / 65535.0,
|
||||||
color.green / 65535.0,
|
color.green / 65535.0,
|
||||||
|
@ -353,6 +354,7 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
|
||||||
/** Draw rectangle with gradient colors
|
/** Draw rectangle with gradient colors
|
||||||
* \param ctx Draw context
|
* \param ctx Draw context
|
||||||
* \param geometry geometry
|
* \param geometry geometry
|
||||||
|
* \param line_width line width
|
||||||
* \param filled filled rectangle?
|
* \param filled filled rectangle?
|
||||||
* \param pattern__x pattern start x coord
|
* \param pattern__x pattern start x coord
|
||||||
* \param pattern_width pattern width
|
* \param pattern_width pattern width
|
||||||
|
@ -361,14 +363,14 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, Bool filled, XColor color)
|
||||||
* \param pcolor_end color at pattern_start + pattern_width
|
* \param pcolor_end color at pattern_start + pattern_width
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, Bool filled,
|
draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, float line_width, Bool filled,
|
||||||
area_t pattern_rect, XColor *pcolor,
|
area_t pattern_rect, XColor *pcolor,
|
||||||
XColor *pcolor_center, XColor *pcolor_end)
|
XColor *pcolor_center, XColor *pcolor_end)
|
||||||
{
|
{
|
||||||
cairo_pattern_t *pat;
|
cairo_pattern_t *pat;
|
||||||
|
|
||||||
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
|
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
|
||||||
cairo_set_line_width(ctx->cr, 1.0);
|
cairo_set_line_width(ctx->cr, line_width);
|
||||||
|
|
||||||
pat = draw_setup_cairo_color_source(ctx, pattern_rect, pcolor, pcolor_center, pcolor_end);
|
pat = draw_setup_cairo_color_source(ctx, pattern_rect, pcolor, pcolor_center, pcolor_end);
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,8 @@ font_t *draw_font_new(Display *disp, char *fontname);
|
||||||
void draw_font_delete(font_t **);
|
void draw_font_delete(font_t **);
|
||||||
|
|
||||||
void draw_text(DrawCtx *, area_t, Alignment, int, char *, style_t);
|
void draw_text(DrawCtx *, area_t, Alignment, int, char *, style_t);
|
||||||
void draw_rectangle(DrawCtx *, area_t, Bool, XColor);
|
void draw_rectangle(DrawCtx *, area_t, float, Bool, XColor);
|
||||||
void draw_rectangle_gradient(DrawCtx *, area_t, Bool, area_t, XColor *, XColor *, XColor *);
|
void draw_rectangle_gradient(DrawCtx *, area_t, float, Bool, area_t, XColor *, XColor *, XColor *);
|
||||||
|
|
||||||
void draw_graph_setup(DrawCtx *);
|
void draw_graph_setup(DrawCtx *);
|
||||||
void draw_graph(DrawCtx *, area_t, int *, int *, int, Position, area_t, XColor *, XColor *, XColor *);
|
void draw_graph(DrawCtx *, area_t, int *, int *, int, Position, area_t, XColor *, XColor *, XColor *);
|
||||||
|
|
|
@ -113,7 +113,7 @@ statusbar_draw(Statusbar *statusbar)
|
||||||
|
|
||||||
rectangle.width = statusbar->width;
|
rectangle.width = statusbar->width;
|
||||||
rectangle.height = statusbar->height;
|
rectangle.height = statusbar->height;
|
||||||
draw_rectangle(statusbar->ctx, rectangle, True,
|
draw_rectangle(statusbar->ctx, rectangle, 1.0, True,
|
||||||
globalconf.screens[statusbar->screen].styles.normal.bg);
|
globalconf.screens[statusbar->screen].styles.normal.bg);
|
||||||
|
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
|
|
|
@ -113,13 +113,13 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
rectangle.y = margin_top;
|
rectangle.y = margin_top;
|
||||||
rectangle.width = d->size + 2;
|
rectangle.width = d->size + 2;
|
||||||
rectangle.height = d->box_height + 2;
|
rectangle.height = d->box_height + 2;
|
||||||
draw_rectangle(ctx, rectangle, False, d->bordercolor);
|
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor);
|
||||||
|
|
||||||
rectangle.x++;
|
rectangle.x++;
|
||||||
rectangle.y++;
|
rectangle.y++;
|
||||||
rectangle.width = d->size;
|
rectangle.width = d->size;
|
||||||
rectangle.height -= 2;
|
rectangle.height -= 2;
|
||||||
draw_rectangle(ctx, rectangle, True, d->bg);
|
draw_rectangle(ctx, rectangle, 1.0, True, d->bg);
|
||||||
|
|
||||||
/* for graph drawing */
|
/* for graph drawing */
|
||||||
rectangle.x = left_offset + 2;
|
rectangle.x = left_offset + 2;
|
||||||
|
|
|
@ -113,7 +113,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
rectangle.y = pb_y;
|
rectangle.y = pb_y;
|
||||||
rectangle.width = pb_width;
|
rectangle.width = pb_width;
|
||||||
rectangle.height = pb_height;
|
rectangle.height = pb_height;
|
||||||
draw_rectangle(ctx, rectangle, False, d->bordercolor[i]);
|
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor[i]);
|
||||||
|
|
||||||
/* new value/progress in px + pattern setup */
|
/* new value/progress in px + pattern setup */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
|
@ -145,10 +145,10 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
/* fg color */
|
/* fg color */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
|
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
|
||||||
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
||||||
else /*REV: bg */
|
else /*REV: bg */
|
||||||
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* top part */
|
/* top part */
|
||||||
|
@ -161,9 +161,9 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
/* bg color */
|
/* bg color */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
|
||||||
else /* REV: bg */
|
else /* REV: bg */
|
||||||
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
|
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
|
||||||
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
||||||
}
|
}
|
||||||
pb_offset += pb_width + d->gap;
|
pb_offset += pb_width + d->gap;
|
||||||
|
@ -178,7 +178,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
rectangle.y = pb_y + pb_offset;
|
rectangle.y = pb_y + pb_offset;
|
||||||
rectangle.width = pb_width;
|
rectangle.width = pb_width;
|
||||||
rectangle.height = pb_height;
|
rectangle.height = pb_height;
|
||||||
draw_rectangle(ctx, rectangle, False, d->bordercolor[i]);
|
draw_rectangle(ctx, rectangle, 1.0, False, d->bordercolor[i]);
|
||||||
|
|
||||||
/* new value/progress in px + pattern setup */
|
/* new value/progress in px + pattern setup */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
|
@ -210,10 +210,10 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
/* fg color */
|
/* fg color */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
|
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
|
||||||
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
||||||
else /* REV: bg */
|
else /* REV: bg */
|
||||||
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* right part */
|
/* right part */
|
||||||
|
@ -226,9 +226,9 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
/* bg color */
|
/* bg color */
|
||||||
if(!d->reverse[i])
|
if(!d->reverse[i])
|
||||||
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
draw_rectangle(ctx, rectangle, 1.0, True, d->bg[i]);
|
||||||
else /* REV: fg */
|
else /* REV: fg */
|
||||||
draw_rectangle_gradient(ctx, rectangle, True, pattern_rect,
|
draw_rectangle_gradient(ctx, rectangle, 1.0, True, pattern_rect,
|
||||||
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
||||||
}
|
}
|
||||||
pb_offset += pb_height + d->gap;
|
pb_offset += pb_height + d->gap;
|
||||||
|
|
|
@ -125,7 +125,7 @@ taglist_draw(Widget *widget,
|
||||||
flagsize,
|
flagsize,
|
||||||
flagsize,
|
flagsize,
|
||||||
NULL, NULL };
|
NULL, NULL };
|
||||||
draw_rectangle(ctx, rectangle, sel && is_client_tagged(sel, tag), style.fg);
|
draw_rectangle(ctx, rectangle, 1.0, sel && is_client_tagged(sel, tag), style.fg);
|
||||||
}
|
}
|
||||||
widget->area.width += w;
|
widget->area.width += w;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
area.height = widget->statusbar->height;
|
area.height = widget->statusbar->height;
|
||||||
area.width = box_width;
|
area.width = box_width;
|
||||||
|
|
||||||
draw_rectangle(ctx, area, True, style.bg);
|
draw_rectangle(ctx, area, 1.0, True, style.bg);
|
||||||
|
|
||||||
if((r = rule_matching_client(c)) && r->icon)
|
if((r = rule_matching_client(c)) && r->icon)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
area.y = widget->area.y;
|
area.y = widget->area.y;
|
||||||
area.width = (style.font->height + 2) / 3;
|
area.width = (style.font->height + 2) / 3;
|
||||||
area.height = (style.font->height + 2) / 3;
|
area.height = (style.font->height + 2) / 3;
|
||||||
draw_rectangle(ctx, area, c->isfloating, style.fg);
|
draw_rectangle(ctx, area, 1.0, c->isfloating, style.fg);
|
||||||
}
|
}
|
||||||
else if(c->isfloating || c->ismax)
|
else if(c->isfloating || c->ismax)
|
||||||
draw_circle(ctx, widget->area.x + icon_width + box_width * i,
|
draw_circle(ctx, widget->area.x + icon_width + box_width * i,
|
||||||
|
|
Loading…
Reference in New Issue