aboutsummaryrefslogtreecommitdiffstats
path: root/packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2005-06-30 08:19:37 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-06-30 08:19:37 +0000
commitc8e5702127e507e82e6f68a4b8c546803accea9d (patch)
tree00583491f40ecc640f2b28452af995e3a63a09d7 /packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff
parent87ec8ca4d2e2eb4d1c1e1e1a6b46a395d56805b9 (diff)
downloadopenembedded-c8e5702127e507e82e6f68a4b8c546803accea9d.tar.gz
import clean BK tree at cset 1.3670
Diffstat (limited to 'packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff')
-rw-r--r--packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff250
1 files changed, 250 insertions, 0 deletions
diff --git a/packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff b/packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff
index e69de29bb2..6a94d96509 100644
--- a/packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff
+++ b/packages/gtk+/gtk+-2.6.4-1.osso7/gtkstyle.c.diff
@@ -0,0 +1,250 @@
+--- gtk+-2.6.4/gtk/gtkstyle.c 2005-01-18 18:43:45.000000000 +0200
++++ gtk+-2.6.4/gtk/gtkstyle.c 2005-04-06 16:19:37.951768816 +0300
+@@ -38,6 +38,7 @@
+ #include "gtkthemes.h"
+ #include "gtkiconfactory.h"
+ #include "gtksettings.h" /* _gtk_settings_parse_convert() */
++#include "gtkhashtable.h"
+
+ #define LIGHTNESS_MULT 1.3
+ #define DARKNESS_MULT 0.7
+@@ -49,6 +50,14 @@
+ GValue value;
+ } PropertyValue;
+
++#define GTK_STYLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_STYLE, GtkStylePrivate))
++
++typedef struct _GtkStylePrivate GtkStylePrivate;
++
++struct _GtkStylePrivate {
++ GSList *logical_color_hashes;
++};
++
+ /* --- prototypes --- */
+ static void gtk_style_init (GtkStyle *style);
+ static void gtk_style_class_init (GtkStyleClass *klass);
+@@ -655,6 +664,7 @@
+ klass->draw_layout = gtk_default_draw_layout;
+ klass->draw_resize_grip = gtk_default_draw_resize_grip;
+
++ g_type_class_add_private (object_class, sizeof (GtkStylePrivate));
+
+ /**
+ * GtkStyle::realize:
+@@ -714,9 +724,28 @@
+ }
+
+ static void
++free_object_list (GSList *list)
++{
++ if (list)
++ {
++ GSList *tmp_list = list;
++
++ while (tmp_list)
++ {
++ g_object_unref (tmp_list->data);
++ tmp_list = tmp_list->next;
++ }
++
++ g_slist_free (list);
++ }
++
++}
++
++static void
+ gtk_style_finalize (GObject *object)
+ {
+ GtkStyle *style = GTK_STYLE (object);
++ GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
+
+ g_return_if_fail (style->attach_count == 0);
+
+@@ -745,19 +774,9 @@
+ g_slist_free_1 (style->styles);
+ }
+ }
+-
+- if (style->icon_factories)
+- {
+- GSList *tmp_list = style->icon_factories;
+-
+- while (tmp_list)
+- {
+- g_object_unref (tmp_list->data);
+- tmp_list = tmp_list->next;
+- }
+-
+- g_slist_free (style->icon_factories);
+- }
++
++ free_object_list (style->icon_factories);
++ free_object_list (priv->logical_color_hashes);
+
+ pango_font_description_free (style->font_desc);
+
+@@ -1003,6 +1022,51 @@
+ return gtk_icon_factory_lookup_default (stock_id);
+ }
+
++ /**
++ * gtk_style_lookup_logical_color:
++ * @style: a #GtkStyle
++ * @color_name: the name of the logical color to look up
++ * @color: the #GdkColor to fill in
++ *
++ * Looks up @color_name in the style's logical color mappings,
++ * filling in @color and returning %TRUE if found, otherwise
++ * returning %FALSE. Do not cache the found mapping, because
++ * it depends on the #GtkStyle and might change when a theme
++ * switch occurs.
++ *
++ * Return value: %TRUE if the mapping was found.
++ */
++gboolean
++gtk_style_lookup_logical_color (GtkStyle *style,
++ const char *color_name,
++ GdkColor *color)
++{
++ GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
++ GSList *iter;
++
++ g_return_val_if_fail (GTK_IS_STYLE (style), FALSE);
++ g_return_val_if_fail (color_name != NULL, FALSE);
++ g_return_val_if_fail (color != NULL, FALSE);
++
++ iter = priv->logical_color_hashes;
++ while (iter != NULL)
++ {
++ GdkColor *mapping = g_hash_table_lookup (GTK_HASH_TABLE (iter->data)->hash,
++ color_name);
++ if (mapping)
++ {
++ color->red = mapping->red;
++ color->green = mapping->green;
++ color->blue = mapping->blue;
++ return TRUE;
++ }
++
++ iter = g_slist_next (iter);
++ }
++
++ return FALSE;
++}
++
+ /**
+ * gtk_draw_hline:
+ * @style: a #GtkStyle
+@@ -1717,10 +1781,32 @@
+ clear_property_cache (style);
+ }
+
++static GSList *
++copy_object_list (GSList *list)
++{
++ if (list)
++ {
++ GSList *iter;
++
++ iter = list;
++ while (iter != NULL)
++ {
++ g_object_ref (iter->data);
++ iter = g_slist_next (iter);
++ }
++
++ return g_slist_copy (list);
++ }
++ else
++ return NULL;
++}
++
+ static void
+ gtk_style_real_init_from_rc (GtkStyle *style,
+ GtkRcStyle *rc_style)
+ {
++ GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
++ GSList *logical_color_hashes;
+ gint i;
+
+ /* cache _should_ be still empty */
+@@ -1746,19 +1832,10 @@
+ if (rc_style->ythickness >= 0)
+ style->ythickness = rc_style->ythickness;
+
+- if (rc_style->icon_factories)
+- {
+- GSList *iter;
++ style->icon_factories = copy_object_list (rc_style->icon_factories);
+
+- style->icon_factories = g_slist_copy (rc_style->icon_factories);
+-
+- iter = style->icon_factories;
+- while (iter != NULL)
+- {
+- g_object_ref (iter->data);
+- iter = g_slist_next (iter);
+- }
+- }
++ logical_color_hashes = _gtk_rc_style_get_logical_color_hashes (rc_style);
++ priv->logical_color_hashes = copy_object_list (logical_color_hashes);
+ }
+
+ static gint
+@@ -2065,7 +2142,7 @@
+ const gchar *detail)
+ {
+ GdkPixbuf *pixbuf;
+-
++
+ g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
+ g_return_val_if_fail (GTK_STYLE_GET_CLASS (style)->render_icon != NULL, NULL);
+
+@@ -2156,7 +2233,7 @@
+ {
+ return gdk_pixbuf_scale_simple (src,
+ width, height,
+- GDK_INTERP_BILINEAR);
++ GDK_INTERP_NEAREST);
+ }
+ }
+
+@@ -2183,7 +2260,6 @@
+ */
+
+ base_pixbuf = gtk_icon_source_get_pixbuf (source);
+-
+ g_return_val_if_fail (base_pixbuf != NULL, NULL);
+
+ if (widget && gtk_widget_has_screen (widget))
+@@ -2213,7 +2289,9 @@
+ /* If the size was wildcarded, and we're allowed to scale, then scale; otherwise,
+ * leave it alone.
+ */
+- if (size != (GtkIconSize)-1 && gtk_icon_source_get_size_wildcarded (source))
++ /* Hildon addition: Device icons are never scaled */
++ if (size != (GtkIconSize)-1 && gtk_icon_source_get_size_wildcarded (source)
++ && size < HILDON_ICON_SIZE_26)
+ scaled = scale_or_ref (base_pixbuf, width, height);
+ else
+ scaled = g_object_ref (base_pixbuf);
+@@ -2224,7 +2302,7 @@
+ if (state == GTK_STATE_INSENSITIVE)
+ {
+ stated = gdk_pixbuf_copy (scaled);
+-
++
+ gdk_pixbuf_saturate_and_pixelate (scaled, stated,
+ 0.8, TRUE);
+
+@@ -2232,8 +2310,8 @@
+ }
+ else if (state == GTK_STATE_PRELIGHT)
+ {
+- stated = gdk_pixbuf_copy (scaled);
+-
++ stated = gdk_pixbuf_copy (scaled);
++
+ gdk_pixbuf_saturate_and_pixelate (scaled, stated,
+ 1.2, FALSE);
+