Gradient on troughs
So, I've gone ahead and implemented an option for adding gradients to scrollbar troughs. I'm pasting the patch below -- it would be great if you would consider it for inclusion in the engine! In addition, it would be nice to get similar gradients on all other troughs too. Maybe I'll add those later.
.
The patch implements two new rc options that allow you to set the trough gradient like this:
trough_gradients = TRUE
trough_shades = {0.90, 0.975, 0.975, 1.05}
.
My patch should be applied to the latest version in Git. For reference, here's what "git show" gives me:
commit 2228998ca9c07cb81faf70e7cc1890458f544683
Author: Andrea Cimitan
Date: Tue Sep 15 18:52:26 2009 +0200
...etc...
.
Here's the patch (from "git diff"):
.
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index de5e540..ad89899 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -1415,21 +1415,6 @@ murrine_draw_scrollbar_trough (cairo_t *cr,
const ScrollBarParameters *scrollbar,
int x, int y, int width, int height)
{
- MurrineRGB border;
- MurrineRGB fill;
-
- murrine_shade (&widget->parentbg,
- get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
- &border);
- murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill);
-/*
- murrine_shade (&colors->bg[widget->state_type],
- get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
- &border_bg);
- murrine_shade (&colors->bg[widget->state_type], scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill_bg);
- murrine_mix_color (&border_bg, &border, 0.5, &border);
- murrine_mix_color (&fill_bg, &fill, 0.5, &fill);
-*/
if (!scrollbar->horizontal)
{
cairo_translate (cr, x, y);
@@ -1442,23 +1427,40 @@ murrine_draw_scrollbar_trough (cairo_t *cr,
width = tmp;
} - /* Draw fill */
- murrine_set_color_rgb (cr, &fill);
- clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
- cairo_fill (cr);
-
- /* Draw border */
- murrine_set_color_rgb (cr, &border);
- if (!scrollbar->within_bevel)
- murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
+ if (widget->mrn_trough_gradient.gradients)
+ {
+ murrine_set_gradient (cr, &widget->parentbg, widget->mrn_trough_gradient, 0, 0, width, 0, widget->mrn_trough_gradient.gradients, FALSE);
+ clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
+ cairo_fill (cr);
+ }
else
{
- cairo_move_to (cr, 0.5, 0);
- cairo_line_to (cr, 0.5, height);
-/* cairo_move_to (cr, width-0.5, 0);*/
-/* cairo_line_to (cr, width-0.5, height);*/
+ MurrineRGB border;
+ MurrineRGB fill;
+
+ murrine_shade (&widget->parentbg,
+ get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
+ &border);
+ murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill);
+
+ /* Draw fill */
+ murrine_set_color_rgb (cr, &fill);
+ clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
+ cairo_fill (cr);
+
+ /* Draw border */
+ murrine_set_color_rgb (cr, &border);
+ if (!scrollbar->within_bevel)
+ murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
+ else
+ {
+ cairo_move_to (cr, 0.5, 0);
+ cairo_line_to (cr, 0.5, height);
+ /* cairo_move_to (cr, width-0.5, 0);*/
+ /* cairo_line_to (cr, width-0.5, height);*/
+ }
+ cairo_stroke (cr);
}
- cairo_stroke (cr);
} static void
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index 1adec9e..5e9d3e8 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -44,6 +44,8 @@ enum
TOKEN_GLOWSTYLE,
TOKEN_GRADIENT_SHADES,
TOKEN_GRADIENTS,
+ TOKEN_TROUGH_SHADES,
+ TOKEN_TROUGH_GRADIENTS,
TOKEN_HIGHLIGHT_SHADE,
TOKEN_LIGHTBORDER_SHADE,
TOKEN_LIGHTBORDERSTYLE,
@@ -97,6 +99,8 @@ theme_symbols[] =
{ "glowstyle", TOKEN_GLOWSTYLE },
{ "gradient_shades", TOKEN_GRADIENT_SHADES },
{ "gradients", TOKEN_GRADIENTS },
+ { "trough_shades", TOKEN_TROUGH_SHADES },
+ { "trough_gradients", TOKEN_TROUGH_GRADIENTS },
{ "highlight_shade", TOKEN_HIGHLIGHT_SHADE },
{ "lightborder_shade", TOKEN_LIGHTBORDER_SHADE },
{ "lightborderstyle", TOKEN_LIGHTBORDERSTYLE },
@@ -159,6 +163,11 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
murrine_rc->gradient_shades[2] = 1.0;
murrine_rc->gradient_shades[3] = 1.1;
murrine_rc->gradients = TRUE;
+ murrine_rc->trough_shades[0] = 1.0;
+ murrine_rc->trough_shades[1] = 1.0;
+ murrine_rc->trough_shades[2] = 1.0;
+ murrine_rc->trough_shades[3] = 1.0;
+ murrine_rc->trough_gradients = TRUE;
murrine_rc->has_scrollbar_color = FALSE;
murrine_rc->highlight_shade = 1.1;
murrine_rc->lightborder_shade = 1.1;
@@ -504,6 +513,14 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_boolean (settings, scanner, &murrine_style->gradients);
murrine_style->flags |= MRN_FLAG_GRADIENTS;
break;
+ case TOKEN_TROUGH_SHADES:
+ token = theme_parse_gradient (settings, scanner, murrine_style->trough_shades);
+ murrine_style->flags |= MRN_FLAG_TROUGH_SHADES;
+ break;
+ case TOKEN_TROUGH_GRADIENTS:
+ token = theme_parse_boolean (settings, scanner, &murrine_style->trough_gradients);
+ murrine_style->flags |= MRN_FLAG_TROUGH_GRADIENTS;
+ break;
case TOKEN_HIGHLIGHT_SHADE:
token = theme_parse_shade (settings, scanner, &murrine_style->highlight_shade);
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
@@ -669,6 +686,15 @@ murrine_rc_style_merge (GtkRcStyle *dest,
}
if (flags & MRN_FLAG_GRADIENTS)
dest_w->gradients = src_w->gradients;
+ if (flags & MRN_FLAG_TROUGH_SHADES)
+ {
+ dest_w->trough_shades[0] = src_w->trough_shades[0];
+ dest_w->trough_shades[1] = src_w->trough_shades[1];
+ dest_w->trough_shades[2] = src_w->trough_shades[2];
+ dest_w->trough_shades[3] = src_w->trough_shades[3];
+ }
+ if (flags & MRN_FLAG_TROUGH_GRADIENTS)
+ dest_w->trough_gradients = src_w->trough_gradients;
if (flags & MRN_FLAG_HIGHLIGHT_SHADE)
dest_w->highlight_shade = src_w->highlight_shade;
if (flags & MRN_FLAG_LIGHTBORDER_SHADE)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index c9242fc..acc217a 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -62,7 +62,9 @@ typedef enum
MRN_FLAG_SCROLLBARSTYLE = 1 << 24,
MRN_FLAG_SLIDERSTYLE = 1 << 25,
MRN_FLAG_STEPPERSTYLE = 1 << 26,
- MRN_FLAG_TOOLBARSTYLE = 1 << 27
+ MRN_FLAG_TOOLBARSTYLE = 1 << 27,
+ MRN_FLAG_TROUGH_SHADES = 1 << 28,
+ MRN_FLAG_TROUGH_GRADIENTS = 1 << 29
} MurrineRcFlags; struct _MurrineRcStyle
@@ -74,6 +76,7 @@ struct _MurrineRcStyle
double contrast;
double glow_shade;
double gradient_shades[4];
+ double trough_shades[4];
double highlight_shade;
double lightborder_shade; @@ -97,6 +100,7 @@ struct _MurrineRcStyle
gboolean animation;
gboolean colorize_scrollbar;
gboolean gradients;
+ gboolean trough_gradients;
gboolean has_focus_color;
gboolean has_scrollbar_color;
gboolean rgba;
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 0ddd7f8..e613954 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -163,12 +163,33 @@ murrine_set_widget_parameters (const GtkWidget *widget,
murrine_style->rgba);
mrn_gradient.rgba_opacity = GRADIENT_OPACITY; + MurrineGradients mrn_trough_gradient;
+ if (murrine_style->trough_gradients)
+ {
+ mrn_trough_gradient.gradient_shades[0] = murrine_style->trough_shades[0];
+ mrn_trough_gradient.gradient_shades[1] = murrine_style->trough_shades[1];
+ mrn_trough_gradient.gradient_shades[2] = murrine_style->trough_shades[2];
+ mrn_trough_gradient.gradient_shades[3] = murrine_style->trough_shades[3];
+ }
+ else
+ {
+ mrn_trough_gradient.gradient_shades[0] = 1.0;
+ mrn_trough_gradient.gradient_shades[1] = 1.0;
+ mrn_trough_gradient.gradient_shades[2] = 1.0;
+ mrn_trough_gradient.gradient_shades[3] = 1.0;
+ }
+ mrn_trough_gradient.gradients = murrine_style->trough_gradients;
+ mrn_trough_gradient.use_rgba = (murrine_widget_is_rgba ((GtkWidget*) widget) &&
+ murrine_style->rgba);
+ mrn_trough_gradient.rgba_opacity = GRADIENT_OPACITY;
+
MurrineStyles mrn_style = MRN_STYLE_MURRINE;
if (mrn_gradient.use_rgba)
{
mrn_style = MRN_STYLE_RGBA;
}
params->mrn_gradient = mrn_gradient;
+ params->mrn_trough_gradient = mrn_trough_gradient;
params->style = mrn_style;
params->style_functions = &(MURRINE_STYLE_GET_CLASS (style)->style_functions[mrn_style]); @@ -963,6 +984,7 @@ murrine_style_draw_box (DRAW_ARGS)
scrollbar.horizontal = TRUE;
scrollbar.junction = murrine_scrollbar_get_junction (widget);
scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
+ scrollbar.style = murrine_style->scrollbarstyle;
scrollbar.stepperstyle = murrine_style->stepperstyle;
scrollbar.within_bevel = within_bevel; @@ -1233,12 +1255,11 @@ murrine_style_draw_box (DRAW_ARGS)
ScrollBarParameters scrollbar;
boolean within_bevel = FALSE; - scrollbar.has_color = FALSE;
- scrollbar.horizontal = TRUE;
- scrollbar.junction = murrine_scrollbar_get_junction (widget);
- scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
- scrollbar.style = murrine_style->scrollbarstyle;
- scrollbar.stepperstyle = murrine_style->stepperstyle;
+ scrollbar.has_color = FALSE;
+ scrollbar.horizontal = TRUE;
+ scrollbar.junction = murrine_scrollbar_get_junction (widget);
+ scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
+ scrollbar.stepperstyle = murrine_style->stepperstyle; if (MRN_IS_RANGE (widget))
scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
@@ -1808,6 +1829,10 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->gradient_shades[1] = MURRINE_RC_STYLE (rc_style)->gradient_shades[1];
murrine_style->gradient_shades[2] = MURRINE_RC_STYLE (rc_style)->gradient_shades[2];
murrine_style->gradient_shades[3] = MURRINE_RC_STYLE (rc_style)->gradient_shades[3];
+ murrine_style->trough_shades[0] = MURRINE_RC_STYLE (rc_style)->trough_shades[0];
+ murrine_style->trough_shades[1] = MURRINE_RC_STYLE (rc_style)->trough_shades[1];
+ murrine_style->trough_shades[2] = MURRINE_RC_STYLE (rc_style)->trough_shades[2];
+ murrine_style->trough_shades[3] = MURRINE_RC_STYLE (rc_style)->trough_shades[3];
/* This is required to avoid glitches on different glazestyles */
if (MURRINE_RC_STYLE (rc_style)->glazestyle != 0)
{
@@ -1830,13 +1855,14 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->roundness = 0;
}
else
- murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
+ murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
murrine_style->animation = MURRINE_RC_STYLE (rc_style)->animation;
murrine_style->contrast = MURRINE_RC_STYLE (rc_style)->contrast;
murrine_style->colorize_scrollbar = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
murrine_style->has_focus_color = MURRINE_RC_STYLE (rc_style)->has_focus_color;
murrine_style->glowstyle = MURRINE_RC_STYLE (rc_style)->glowstyle;
murrine_style->gradients = MURRINE_RC_STYLE (rc_style)->gradients;
+ murrine_style->trough_gradients = MURRINE_RC_STYLE (rc_style)->trough_gradients;
murrine_style->has_scrollbar_color = MURRINE_RC_STYLE (rc_style)->has_scrollbar_color;
murrine_style->lightborderstyle = MURRINE_RC_STYLE (rc_style)->lightborderstyle;
murrine_style->listviewheaderstyle = MURRINE_RC_STYLE (rc_style)->listviewheaderstyle;
@@ -2187,7 +2213,12 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
mrn_style->gradient_shades[1] = mrn_src->gradient_shades[1];
mrn_style->gradient_shades[2] = mrn_src->gradient_shades[2];
mrn_style->gradient_shades[3] = mrn_src->gradient_shades[3];
+ mrn_style->trough_shades[0] = mrn_src->trough_shades[0];
+ mrn_style->trough_shades[1] = mrn_src->trough_shades[1];
+ mrn_style->trough_shades[2] = mrn_src->trough_shades[2];
+ mrn_style->trough_shades[3] = mrn_src->trough_shades[3];
mrn_style->gradients = mrn_src->gradients;
+ mrn_style->trough_gradients = mrn_src->trough_gradients;
mrn_style->has_focus_color = mrn_src->has_focus_color;
mrn_style->has_scrollbar_color = mrn_src->has_scrollbar_color;
mrn_style->highlight_shade = mrn_src->highlight_shade;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index d88fce5..ea47ab9 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -47,6 +47,7 @@ struct _MurrineStyle
double contrast;
double glow_shade;
double gradient_shades[4];
+ double trough_shades[4];
double highlight_shade;
double lightborder_shade; @@ -70,6 +71,7 @@ struct _MurrineStyle
gboolean animation;
gboolean colorize_scrollbar;
gboolean gradients;
+ gboolean trough_gradients;
gboolean has_focus_color;
gboolean has_scrollbar_color;
gboolean rgba;
diff --git a/src/murrine_types.h b/src/murrine_types.h
index c1eae79..32f4e52 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -224,6 +224,7 @@ typedef struct
double highlight_shade;
double lightborder_shade;
MurrineGradients mrn_gradient;
+ MurrineGradients mrn_trough_gradient; MurrineStyles style;
MurrineStyleFunctions *style_functions;
.
The patch implements two new rc options that allow you to set the trough gradient like this:
trough_gradients = TRUE
trough_shades = {0.90, 0.975, 0.975, 1.05}
.
My patch should be applied to the latest version in Git. For reference, here's what "git show" gives me:
commit 2228998ca9c07cb81faf70e7cc1890458f544683
Author: Andrea Cimitan
Date: Tue Sep 15 18:52:26 2009 +0200
...etc...
.
Here's the patch (from "git diff"):
.
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index de5e540..ad89899 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -1415,21 +1415,6 @@ murrine_draw_scrollbar_trough (cairo_t *cr,
const ScrollBarParameters *scrollbar,
int x, int y, int width, int height)
{
- MurrineRGB border;
- MurrineRGB fill;
-
- murrine_shade (&widget->parentbg,
- get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
- &border);
- murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill);
-/*
- murrine_shade (&colors->bg[widget->state_type],
- get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
- &border_bg);
- murrine_shade (&colors->bg[widget->state_type], scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill_bg);
- murrine_mix_color (&border_bg, &border, 0.5, &border);
- murrine_mix_color (&fill_bg, &fill, 0.5, &fill);
-*/
if (!scrollbar->horizontal)
{
cairo_translate (cr, x, y);
@@ -1442,23 +1427,40 @@ murrine_draw_scrollbar_trough (cairo_t *cr,
width = tmp;
} - /* Draw fill */
- murrine_set_color_rgb (cr, &fill);
- clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
- cairo_fill (cr);
-
- /* Draw border */
- murrine_set_color_rgb (cr, &border);
- if (!scrollbar->within_bevel)
- murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
+ if (widget->mrn_trough_gradient.gradients)
+ {
+ murrine_set_gradient (cr, &widget->parentbg, widget->mrn_trough_gradient, 0, 0, width, 0, widget->mrn_trough_gradient.gradients, FALSE);
+ clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
+ cairo_fill (cr);
+ }
else
{
- cairo_move_to (cr, 0.5, 0);
- cairo_line_to (cr, 0.5, height);
-/* cairo_move_to (cr, width-0.5, 0);*/
-/* cairo_line_to (cr, width-0.5, height);*/
+ MurrineRGB border;
+ MurrineRGB fill;
+
+ murrine_shade (&widget->parentbg,
+ get_contrast (scrollbar->stepperstyle < 1 ? 0.86 : 0.8, widget->contrast),
+ &border);
+ murrine_shade (&widget->parentbg, scrollbar->stepperstyle < 1 ? 0.97 : 1.026, &fill);
+
+ /* Draw fill */
+ murrine_set_color_rgb (cr, &fill);
+ clearlooks_rounded_rectangle (cr, 0, 0, width, height, widget->roundness, widget->corners);
+ cairo_fill (cr);
+
+ /* Draw border */
+ murrine_set_color_rgb (cr, &border);
+ if (!scrollbar->within_bevel)
+ murrine_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
+ else
+ {
+ cairo_move_to (cr, 0.5, 0);
+ cairo_line_to (cr, 0.5, height);
+ /* cairo_move_to (cr, width-0.5, 0);*/
+ /* cairo_line_to (cr, width-0.5, height);*/
+ }
+ cairo_stroke (cr);
}
- cairo_stroke (cr);
} static void
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index 1adec9e..5e9d3e8 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -44,6 +44,8 @@ enum
TOKEN_GLOWSTYLE,
TOKEN_GRADIENT_SHADES,
TOKEN_GRADIENTS,
+ TOKEN_TROUGH_SHADES,
+ TOKEN_TROUGH_GRADIENTS,
TOKEN_HIGHLIGHT_SHADE,
TOKEN_LIGHTBORDER_SHADE,
TOKEN_LIGHTBORDERSTYLE,
@@ -97,6 +99,8 @@ theme_symbols[] =
{ "glowstyle", TOKEN_GLOWSTYLE },
{ "gradient_shades", TOKEN_GRADIENT_SHADES },
{ "gradients", TOKEN_GRADIENTS },
+ { "trough_shades", TOKEN_TROUGH_SHADES },
+ { "trough_gradients", TOKEN_TROUGH_GRADIENTS },
{ "highlight_shade", TOKEN_HIGHLIGHT_SHADE },
{ "lightborder_shade", TOKEN_LIGHTBORDER_SHADE },
{ "lightborderstyle", TOKEN_LIGHTBORDERSTYLE },
@@ -159,6 +163,11 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
murrine_rc->gradient_shades[2] = 1.0;
murrine_rc->gradient_shades[3] = 1.1;
murrine_rc->gradients = TRUE;
+ murrine_rc->trough_shades[0] = 1.0;
+ murrine_rc->trough_shades[1] = 1.0;
+ murrine_rc->trough_shades[2] = 1.0;
+ murrine_rc->trough_shades[3] = 1.0;
+ murrine_rc->trough_gradients = TRUE;
murrine_rc->has_scrollbar_color = FALSE;
murrine_rc->highlight_shade = 1.1;
murrine_rc->lightborder_shade = 1.1;
@@ -504,6 +513,14 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_boolean (settings, scanner, &murrine_style->gradients);
murrine_style->flags |= MRN_FLAG_GRADIENTS;
break;
+ case TOKEN_TROUGH_SHADES:
+ token = theme_parse_gradient (settings, scanner, murrine_style->trough_shades);
+ murrine_style->flags |= MRN_FLAG_TROUGH_SHADES;
+ break;
+ case TOKEN_TROUGH_GRADIENTS:
+ token = theme_parse_boolean (settings, scanner, &murrine_style->trough_gradients);
+ murrine_style->flags |= MRN_FLAG_TROUGH_GRADIENTS;
+ break;
case TOKEN_HIGHLIGHT_SHADE:
token = theme_parse_shade (settings, scanner, &murrine_style->highlight_shade);
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
@@ -669,6 +686,15 @@ murrine_rc_style_merge (GtkRcStyle *dest,
}
if (flags & MRN_FLAG_GRADIENTS)
dest_w->gradients = src_w->gradients;
+ if (flags & MRN_FLAG_TROUGH_SHADES)
+ {
+ dest_w->trough_shades[0] = src_w->trough_shades[0];
+ dest_w->trough_shades[1] = src_w->trough_shades[1];
+ dest_w->trough_shades[2] = src_w->trough_shades[2];
+ dest_w->trough_shades[3] = src_w->trough_shades[3];
+ }
+ if (flags & MRN_FLAG_TROUGH_GRADIENTS)
+ dest_w->trough_gradients = src_w->trough_gradients;
if (flags & MRN_FLAG_HIGHLIGHT_SHADE)
dest_w->highlight_shade = src_w->highlight_shade;
if (flags & MRN_FLAG_LIGHTBORDER_SHADE)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index c9242fc..acc217a 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -62,7 +62,9 @@ typedef enum
MRN_FLAG_SCROLLBARSTYLE = 1 << 24,
MRN_FLAG_SLIDERSTYLE = 1 << 25,
MRN_FLAG_STEPPERSTYLE = 1 << 26,
- MRN_FLAG_TOOLBARSTYLE = 1 << 27
+ MRN_FLAG_TOOLBARSTYLE = 1 << 27,
+ MRN_FLAG_TROUGH_SHADES = 1 << 28,
+ MRN_FLAG_TROUGH_GRADIENTS = 1 << 29
} MurrineRcFlags; struct _MurrineRcStyle
@@ -74,6 +76,7 @@ struct _MurrineRcStyle
double contrast;
double glow_shade;
double gradient_shades[4];
+ double trough_shades[4];
double highlight_shade;
double lightborder_shade; @@ -97,6 +100,7 @@ struct _MurrineRcStyle
gboolean animation;
gboolean colorize_scrollbar;
gboolean gradients;
+ gboolean trough_gradients;
gboolean has_focus_color;
gboolean has_scrollbar_color;
gboolean rgba;
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 0ddd7f8..e613954 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -163,12 +163,33 @@ murrine_set_widget_parameters (const GtkWidget *widget,
murrine_style->rgba);
mrn_gradient.rgba_opacity = GRADIENT_OPACITY; + MurrineGradients mrn_trough_gradient;
+ if (murrine_style->trough_gradients)
+ {
+ mrn_trough_gradient.gradient_shades[0] = murrine_style->trough_shades[0];
+ mrn_trough_gradient.gradient_shades[1] = murrine_style->trough_shades[1];
+ mrn_trough_gradient.gradient_shades[2] = murrine_style->trough_shades[2];
+ mrn_trough_gradient.gradient_shades[3] = murrine_style->trough_shades[3];
+ }
+ else
+ {
+ mrn_trough_gradient.gradient_shades[0] = 1.0;
+ mrn_trough_gradient.gradient_shades[1] = 1.0;
+ mrn_trough_gradient.gradient_shades[2] = 1.0;
+ mrn_trough_gradient.gradient_shades[3] = 1.0;
+ }
+ mrn_trough_gradient.gradients = murrine_style->trough_gradients;
+ mrn_trough_gradient.use_rgba = (murrine_widget_is_rgba ((GtkWidget*) widget) &&
+ murrine_style->rgba);
+ mrn_trough_gradient.rgba_opacity = GRADIENT_OPACITY;
+
MurrineStyles mrn_style = MRN_STYLE_MURRINE;
if (mrn_gradient.use_rgba)
{
mrn_style = MRN_STYLE_RGBA;
}
params->mrn_gradient = mrn_gradient;
+ params->mrn_trough_gradient = mrn_trough_gradient;
params->style = mrn_style;
params->style_functions = &(MURRINE_STYLE_GET_CLASS (style)->style_functions[mrn_style]); @@ -963,6 +984,7 @@ murrine_style_draw_box (DRAW_ARGS)
scrollbar.horizontal = TRUE;
scrollbar.junction = murrine_scrollbar_get_junction (widget);
scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
+ scrollbar.style = murrine_style->scrollbarstyle;
scrollbar.stepperstyle = murrine_style->stepperstyle;
scrollbar.within_bevel = within_bevel; @@ -1233,12 +1255,11 @@ murrine_style_draw_box (DRAW_ARGS)
ScrollBarParameters scrollbar;
boolean within_bevel = FALSE; - scrollbar.has_color = FALSE;
- scrollbar.horizontal = TRUE;
- scrollbar.junction = murrine_scrollbar_get_junction (widget);
- scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
- scrollbar.style = murrine_style->scrollbarstyle;
- scrollbar.stepperstyle = murrine_style->stepperstyle;
+ scrollbar.has_color = FALSE;
+ scrollbar.horizontal = TRUE;
+ scrollbar.junction = murrine_scrollbar_get_junction (widget);
+ scrollbar.steppers = murrine_scrollbar_visible_steppers (widget);
+ scrollbar.stepperstyle = murrine_style->stepperstyle; if (MRN_IS_RANGE (widget))
scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
@@ -1808,6 +1829,10 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->gradient_shades[1] = MURRINE_RC_STYLE (rc_style)->gradient_shades[1];
murrine_style->gradient_shades[2] = MURRINE_RC_STYLE (rc_style)->gradient_shades[2];
murrine_style->gradient_shades[3] = MURRINE_RC_STYLE (rc_style)->gradient_shades[3];
+ murrine_style->trough_shades[0] = MURRINE_RC_STYLE (rc_style)->trough_shades[0];
+ murrine_style->trough_shades[1] = MURRINE_RC_STYLE (rc_style)->trough_shades[1];
+ murrine_style->trough_shades[2] = MURRINE_RC_STYLE (rc_style)->trough_shades[2];
+ murrine_style->trough_shades[3] = MURRINE_RC_STYLE (rc_style)->trough_shades[3];
/* This is required to avoid glitches on different glazestyles */
if (MURRINE_RC_STYLE (rc_style)->glazestyle != 0)
{
@@ -1830,13 +1855,14 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->roundness = 0;
}
else
- murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
+ murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
murrine_style->animation = MURRINE_RC_STYLE (rc_style)->animation;
murrine_style->contrast = MURRINE_RC_STYLE (rc_style)->contrast;
murrine_style->colorize_scrollbar = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
murrine_style->has_focus_color = MURRINE_RC_STYLE (rc_style)->has_focus_color;
murrine_style->glowstyle = MURRINE_RC_STYLE (rc_style)->glowstyle;
murrine_style->gradients = MURRINE_RC_STYLE (rc_style)->gradients;
+ murrine_style->trough_gradients = MURRINE_RC_STYLE (rc_style)->trough_gradients;
murrine_style->has_scrollbar_color = MURRINE_RC_STYLE (rc_style)->has_scrollbar_color;
murrine_style->lightborderstyle = MURRINE_RC_STYLE (rc_style)->lightborderstyle;
murrine_style->listviewheaderstyle = MURRINE_RC_STYLE (rc_style)->listviewheaderstyle;
@@ -2187,7 +2213,12 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
mrn_style->gradient_shades[1] = mrn_src->gradient_shades[1];
mrn_style->gradient_shades[2] = mrn_src->gradient_shades[2];
mrn_style->gradient_shades[3] = mrn_src->gradient_shades[3];
+ mrn_style->trough_shades[0] = mrn_src->trough_shades[0];
+ mrn_style->trough_shades[1] = mrn_src->trough_shades[1];
+ mrn_style->trough_shades[2] = mrn_src->trough_shades[2];
+ mrn_style->trough_shades[3] = mrn_src->trough_shades[3];
mrn_style->gradients = mrn_src->gradients;
+ mrn_style->trough_gradients = mrn_src->trough_gradients;
mrn_style->has_focus_color = mrn_src->has_focus_color;
mrn_style->has_scrollbar_color = mrn_src->has_scrollbar_color;
mrn_style->highlight_shade = mrn_src->highlight_shade;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index d88fce5..ea47ab9 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -47,6 +47,7 @@ struct _MurrineStyle
double contrast;
double glow_shade;
double gradient_shades[4];
+ double trough_shades[4];
double highlight_shade;
double lightborder_shade; @@ -70,6 +71,7 @@ struct _MurrineStyle
gboolean animation;
gboolean colorize_scrollbar;
gboolean gradients;
+ gboolean trough_gradients;
gboolean has_focus_color;
gboolean has_scrollbar_color;
gboolean rgba;
diff --git a/src/murrine_types.h b/src/murrine_types.h
index c1eae79..32f4e52 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -224,6 +224,7 @@ typedef struct
double highlight_shade;
double lightborder_shade;
MurrineGradients mrn_gradient;
+ MurrineGradients mrn_trough_gradient; MurrineStyles style;
MurrineStyleFunctions *style_functions;
Thank you for your patch,
I'm not sure what you mean.
What do you think about the
Not this patch, but I have
Post new comment