aboutsummaryrefslogtreecommitdiff
path: root/src/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.c')
-rw-r--r--src/draw.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/draw.c b/src/draw.c
index 8b4d329..0961f6f 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -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, int line_w)
+Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, int line_w)
{
Drawable *draw = g_malloc(sizeof(Drawable));
g_assert_nonnull(draw);
@@ -31,13 +31,11 @@ Drawable *draw_create(const char *font, int height, int left_pad, int right_pad,
draw->left_pad = left_pad;
draw->right_pad = right_pad;
draw->top_pad = top_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);
+ log_debug("Draw context created [height=%d, left_pad=%d, right_pad=%d, top_pad=%d, line_w=%d]", height, left_pad, right_pad, top_pad, line_w);
return draw;
}
@@ -73,7 +71,7 @@ void draw_paint(Drawable *draw, Window *win)
int radius = height / 2;
double degree = M_PI / 180.0;
- cairo_set_source_rgba(cr, 0.3, 0.3, 0.3, draw->alpha);
+ cairo_set_source_rgba(cr, draw->background.r, draw->background.g, draw->background.b, draw->background.a);
// TODO: Here we should paint the shape of the bar, however there is a problem with the surface
// painted in the pixmap to mask the window shape in window_paint_corners.
@@ -252,6 +250,11 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns)
g_list_free(btns);
}
+void draw_set_background(Drawable *draw, Color background)
+{
+ draw->background = background;
+}
+
void draw_destroy(Drawable *draw)
{
g_list_free_full(draw->layouts, (GDestroyNotify)layout_destroy);