diff --git a/ChangeLog b/ChangeLog index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 521ce19ba..bcc80ad95 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Mon Mar 9 01:01:41 1998 Owen Taylor + + * gtk/gtkrc.c: No, you can't add a GtkStyle * to a + list of GtkRcNode *. (Fixes huge performance problem) + Plus, don't bother creating a new style unless style + actually has bg pixmaps. + Sun Mar 8 15:53:33 1998 Owen Taylor * gtk/gtktext.c: diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index d09201e39..21cb92eb3 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -483,26 +483,44 @@ static GtkStyle * gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap) { GdkFont *old_font; + gboolean match_cmap = FALSE; gint i; GList *tmp_list; GtkStyle *style = NULL; + GtkRcNode *node; tmp_list = rc_style->styles; + for (i=0; i<5; i++) + if (rc_style->bg_pixmap_name[i]) + match_cmap = TRUE; + while (tmp_list) { - GtkRcNode *node = (GtkRcNode *)tmp_list->data; + node = (GtkRcNode *)tmp_list->data; - if (node->cmap == cmap) - style = node->style; + if (!match_cmap || (node->cmap == cmap)) + { + style = node->style; + break; + } tmp_list = tmp_list->next; } if (!style) { + node = g_new (GtkRcNode, 1); style = gtk_style_copy (rc_style->proto_style); + + /* FIXME, this leaks colormaps, but if we don't do this, then we'll + * be screwed, because we identify colormaps by address equality + */ + gdk_colormap_ref (cmap); + + node->style = style; + node->cmap = cmap; if (rc_style->fontset_name) { @@ -536,12 +554,7 @@ gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap) rc_style->bg_pixmap_name[i]); } - rc_style->styles = g_list_append (rc_style->styles, style); - - /* FIXME, this leaks colormaps, but if we don't do this, then we'll - * be screwed, because we identify colormaps by address equality - */ - gdk_colormap_ref (cmap); + rc_style->styles = g_list_append (rc_style->styles, node); } return style;