[gtk+/gtk-style-context: 357/540] GtkStyleContext: Resolve symbolic colors for widget style properties.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 357/540] GtkStyleContext: Resolve symbolic colors for widget style properties.
- Date: Fri, 3 Dec 2010 03:06:09 +0000 (UTC)
commit 7a4b2a52592279ba461aa3b61eb4d85284575b8f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Nov 13 02:18:11 2010 +0100
GtkStyleContext: Resolve symbolic colors for widget style properties.
gtk/gtkstylecontext.c | 43 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index e465a1b..8023f9b 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2018,13 +2018,48 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
{
for (list = priv->providers_last; list; list = list->prev)
{
- GtkStyleProviderData *data;
+ GtkStyleProviderData *provider_data;
- data = list->data;
+ provider_data = list->data;
- if (gtk_style_provider_get_style_property (data->provider, priv->widget_path,
+ if (gtk_style_provider_get_style_property (provider_data->provider, priv->widget_path,
pspec->name, &pcache->value))
- return &pcache->value;
+ {
+ /* Resolve symbolic colors to GdkColor/GdkRGBA */
+ if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
+ {
+ GtkSymbolicColor *color;
+ GdkRGBA rgba;
+
+ color = g_value_get_boxed (&pcache->value);
+
+ if (gtk_symbolic_color_resolve (color, data->store, &rgba))
+ {
+ g_value_unset (&pcache->value);
+
+ if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
+ {
+ g_value_init (&pcache->value, GDK_TYPE_RGBA);
+ g_value_set_boxed (&pcache->value, &rgba);
+ }
+ else
+ {
+ GdkColor rgb;
+
+ rgb.red = rgba.red * 65535. + 0.5;
+ rgb.green = rgba.green * 65535. + 0.5;
+ rgb.blue = rgba.blue * 65535. + 0.5;
+
+ g_value_init (&pcache->value, GDK_TYPE_COLOR);
+ g_value_set_boxed (&pcache->value, &rgb);
+ }
+ }
+ else
+ g_param_value_set_default (pspec, &pcache->value);
+ }
+
+ return &pcache->value;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]