From 3feed0c67e8713fa9db08605ff21740d41d321c0 Mon Sep 17 00:00:00 2001 From: Omer Akram Date: Mon, 17 Feb 2014 11:52:58 +0100 Subject: Cut with fading the Bar title when it's longer than the decoration bar. --- src/ui/theme.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/ui/theme.c b/src/ui/theme.c index 589c68e5..4d430b7c 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -3850,6 +3850,33 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op, rx = parse_x_position_unchecked (op->data.title.x, env); ry = parse_y_position_unchecked (op->data.title.y, env); + if (rx - env->rect.x + env->title_width >= env->rect.width) + { + const double alpha_margin = 30.0; + int text_space = env->rect.x + env->rect.width - + (rx - env->rect.x) - env->right_width; + + double startalpha = 1.0 - (alpha_margin/((double)text_space)); + + cairo_pattern_t *linpat; + linpat = cairo_pattern_create_linear (rx, ry, text_space, + env->title_height); + cairo_pattern_add_color_stop_rgb (linpat, 0, color.red/65535.0, + color.green/65535.0, + color.blue/65535.0); + cairo_pattern_add_color_stop_rgb (linpat, startalpha, + color.red/65535.0, + color.green/65535.0, + color.blue/65535.0); + cairo_pattern_add_color_stop_rgba (linpat, 1, color.red/65535.0, + color.green/65535.0, + color.blue/65535.0, 0); + cairo_set_source(cr, linpat); + cairo_pattern_destroy(linpat); + } else { + gdk_cairo_set_source_color (cr, &color); + } + cairo_move_to (cr, rx, ry); pango_cairo_show_layout (cr, info->title_layout); } -- cgit v1.2.1