diff options
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -18,7 +18,7 @@ static void layout_destroy(Layout *layout) g_free(layout); } -Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, double alpha) +Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, double alpha, int line_w) { Drawable *draw = g_malloc(sizeof(Drawable)); g_assert_nonnull(draw); @@ -34,6 +34,7 @@ Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, draw->alpha = alpha; g_assert(alpha >= 0 && alpha <= 1); + draw->line_w = line_w; draw->layouts = NULL; log_debug("Draw context created [height=%d, left_pad=%d, right_pad=%d, top_pad=%d, alpha=%.2lf]", height, left_pad, right_pad, top_pad, alpha); @@ -86,7 +87,7 @@ void draw_paint(Drawable *draw, Window *win) cairo_paint(cr); - int line_w = 1 * scale; + int line_w = draw->line_w * scale; cairo_set_line_width(cr, line_w); for (GList *it = draw->layouts; it; it = it->next) { @@ -95,22 +96,24 @@ void draw_paint(Drawable *draw, Window *win) int text_x = layout->x + (layout->width / 2) - (layout->text_w / 2); int text_y = layout->y + (layout->height / 2) - (layout->text_h / 2); - // purple - cairo_set_source_rgba(cr, 0.502, 0.168, 0.886, 1); + Color color = layout->btn->background; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_new_sub_path(cr); cairo_arc(cr, layout->x + radius, layout->y + radius, radius, 90 * degree, 270 * degree); cairo_arc(cr, layout->x + layout->width - radius, layout->y + radius, radius, 270 * degree, 450 * degree); cairo_close_path(cr); cairo_fill(cr); - cairo_set_source_rgba(cr, 0.8, 0.8, 0.8, 1); + color = layout->btn->stroke; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_new_sub_path(cr); cairo_arc(cr, layout->x + radius, layout->y + radius, radius - line_w , 90 * degree, 270 * degree); cairo_arc(cr, layout->x + layout->width - radius, layout->y + radius, radius - line_w, 270 * degree, 450 * degree); cairo_close_path(cr); cairo_stroke(cr); - cairo_set_source_rgb(cr, 0.8, 0.8, 0.8); + color = layout->btn->foreground; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_move_to(cr, text_x, text_y); pango_cairo_update_layout(cr, layout->pl); @@ -153,7 +156,7 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns) int radius = height / 2; int sep = 10 * scale; - int line_w = 1 * scale; + int line_w = draw->line_w * scale; btns = g_list_sort(btns, align_compare); @@ -166,7 +169,6 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns) for (GList *it = btns; it; it = it->next) { Button *btn = it->data; - Layout *layout = g_malloc(sizeof(Layout)); layout->btn = btn; |
