summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarex <marex@beryl-project.org>2007-02-20 13:20:17 +0100
committermarex <marex@beryl-project.org>2007-02-20 13:20:17 +0100
commit913f1327535ad7a7b297d758ce66ad5fe942accc (patch)
tree9dd5066118c793bb79878fb402a4a815b0419bc3
parent40718e76a09ddd3aa56b95140d3525a0726e98b5 (diff)
downloadmarex-dev-913f1327535ad7a7b297d758ce66ad5fe942accc.tar.gz
marex-dev-913f1327535ad7a7b297d758ce66ad5fe942accc.tar.bz2
group: Added new styles Glass and Simple
-rw-r--r--beryl-plugins/src/group/option.c6
-rw-r--r--beryl-plugins/src/group/paint.c133
2 files changed, 115 insertions, 24 deletions
diff --git a/beryl-plugins/src/group/option.c b/beryl-plugins/src/group/option.c
index 7615044..84db324 100644
--- a/beryl-plugins/src/group/option.c
+++ b/beryl-plugins/src/group/option.c
@@ -131,9 +131,9 @@
#define GROUP_COLOR_LINE_BLUE_DEFAULT 0x0000
#define GROUP_COLOR_LINE_ALPHA_DEFAULT 0xABAB
-#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_RED_DEFAULT 0x5555
-#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_GREEN_DEFAULT 0x5555
-#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_BLUE_DEFAULT 0x5555
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_RED_DEFAULT 0xC1C1
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_GREEN_DEFAULT 0xC1C1
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_BLUE_DEFAULT 0xC1C1
#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_ALPHA_DEFAULT 0x9999
#define GROUP_COLOR_TAB_FILL_BASE_RED_DEFAULT 0x0000
diff --git a/beryl-plugins/src/group/paint.c b/beryl-plugins/src/group/paint.c
index 4ebc5c2..a7e769d 100644
--- a/beryl-plugins/src/group/paint.c
+++ b/beryl-plugins/src/group/paint.c
@@ -195,34 +195,125 @@ void groupRenderTabBarBackground(GroupSelection *group)
cairo_set_line_width(cr, 2);
- cairo_move_to(cr, 0, 0);
cairo_move_to (cr, x + radius, y);
cairo_arc (cr, x + width - radius, y + radius, radius, M_PI * 1.5, M_PI * 2.0);
cairo_arc (cr, x + width - radius, y + height - radius, radius, 0.0, M_PI * 0.5);
cairo_arc (cr, x + radius, y + height - radius, radius, M_PI * 0.5, M_PI);
cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
- // fill
- cairo_pattern_t *pattern;
- pattern = cairo_pattern_create_linear(0, 0, width, height);
-
- // highlight color
- r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[0] / 65535.0f;
- g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[1] / 65535.0f;
- b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[2] / 65535.0f;
- a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[3] / 65535.0f;
- cairo_pattern_add_color_stop_rgba(pattern, 0.0f, r, g, b, a);
-
- // base color
- r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
- g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
- b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
- a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
- cairo_pattern_add_color_stop_rgba(pattern, 1.0f, r, g, b, a);
+ switch (gs->tabBarStyle)
+ {
+ case StyleSimple:
+ {
+ // base color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
+ cairo_set_source_rgba(cr, r, g, b, a);
+
+ cairo_fill_preserve(cr);
+ break;
+ }
+
+ case StyleGradient:
+ {
+ // fill
+ cairo_pattern_t *pattern;
+ pattern = cairo_pattern_create_linear(0, 0, width, height);
+
+ // highlight color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 0.0f, r, g, b, a);
+
+ // base color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 1.0f, r, g, b, a);
- cairo_set_source(cr, pattern);
- cairo_fill_preserve(cr);
- cairo_pattern_destroy(pattern);
+ cairo_set_source(cr, pattern);
+ cairo_fill_preserve(cr);
+ cairo_pattern_destroy(pattern);
+ break;
+ }
+
+ case StyleGlass:
+ {
+ // ===== HIGHLIGHT =====
+ cairo_save(cr);
+
+ // clip
+ cairo_clip(cr);
+ cairo_rectangle(cr, 0, 0, width, height/2);
+ cairo_clip(cr);
+
+ // draw shape again
+ cairo_move_to (cr, x + radius, y);
+ cairo_arc (cr, x + width - radius, y + radius, radius, M_PI * 1.5, M_PI * 2.0);
+ cairo_arc (cr, x + width - radius, y + height - radius, radius, 0.0, M_PI * 0.5);
+ cairo_arc (cr, x + radius, y + height - radius, radius, M_PI * 0.5, M_PI);
+ cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
+
+ // fill
+ cairo_pattern_t *pattern;
+ pattern = cairo_pattern_create_linear(0, 0, 0, height);
+
+ // highlight color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 0.0f, r, g, b, a);
+
+ // base color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 0.6f, r, g, b, a);
+
+ cairo_set_source(cr, pattern);
+ cairo_fill_preserve(cr);
+ cairo_pattern_destroy(pattern);
+
+ cairo_restore(cr);
+
+ // ==== BASE =====
+ cairo_save(cr);
+
+ // clip
+ cairo_clip(cr);
+ cairo_rectangle(cr, 0, height/2, width, height);
+ cairo_clip(cr);
+
+ // draw shape again
+ cairo_move_to (cr, x + radius, y);
+ cairo_arc (cr, x + width - radius, y + radius, radius, M_PI * 1.5, M_PI * 2.0);
+ cairo_arc (cr, x + width - radius, y + height - radius, radius, 0.0, M_PI * 0.5);
+ cairo_arc (cr, x + radius, y + height - radius, radius, M_PI * 0.5, M_PI);
+ cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
+
+ // now a simple fill for the background
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
+ cairo_set_source_rgba(cr, r, g, b, a);
+ cairo_fill_preserve(cr);
+
+ cairo_restore(cr);
+
+ break;
+ }
+
+ default:
+ break;
+ }
// outline
r = gs->opt[GROUP_SCREEN_OPTION_TAB_BORDER_COLOR].value.c[0] / 65535.0f;