diff options
author | Benjamin Otte <otte@redhat.com> | 2012-03-28 06:28:13 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-04-17 08:59:14 +0200 |
commit | 58b6d492b889f08cdb27b866b166bbda956bf6c9 (patch) | |
tree | bdcf7c5bbe6c2a50d75cbd1678b10169620490a2 /gtk/gtkcssstylefuncs.c | |
parent | dcec7a5529f1a149bd3a02683a67d1c1bfd3702c (diff) | |
download | gtk+-58b6d492b889f08cdb27b866b166bbda956bf6c9.tar.gz |
cssvalue: Add a custom RGBA value
Note: custom CSS properties still use the default GtkCssValue and always
will.
So there is a difference in css values used between those, even though
they both carry a GdkRGBA payload.
Diffstat (limited to 'gtk/gtkcssstylefuncs.c')
-rw-r--r-- | gtk/gtkcssstylefuncs.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index 727c788207..eaade29581 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -30,6 +30,7 @@ #include "gtkanimationdescription.h" #include "gtkcssimagegradientprivate.h" #include "gtkcssprovider.h" +#include "gtkcssrgbavalueprivate.h" #include "gtkcsstypesprivate.h" #include "gtkgradient.h" #include "gtkprivatetypebuiltins.h" @@ -213,24 +214,21 @@ rgba_value_print (const GValue *value, static GtkCssValue * rgba_value_compute (GtkStyleContext *context, - GtkCssValue *specified) + GtkCssValue *specified) { GdkRGBA white = { 1, 1, 1, 1 }; - GtkCssValue *res; if (_gtk_css_value_holds (specified, GTK_TYPE_SYMBOLIC_COLOR)) { GtkSymbolicColor *symbolic = _gtk_css_value_get_symbolic_color (specified); + GdkRGBA rgba; if (symbolic == _gtk_symbolic_color_get_current_color ()) - return _gtk_css_value_ref (_gtk_style_context_peek_property (context, "color")); - else { - res = _gtk_style_context_resolve_color_value (context, symbolic); - if (res != NULL) - return res; + rgba = *_gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, "color")); + else if (!gtk_symbolic_color_resolve (symbolic, NULL, &rgba)) + rgba = white; - return _gtk_css_value_new_from_rgba (&white); - } + return _gtk_css_value_new_from_boxed (GDK_TYPE_RGBA, &rgba); } else return _gtk_css_value_ref (specified); |