bg_pixmap[] = "<none>"




Unless there are objections, I'm going to commit the following
patch to GTK+. What it does is add the ability to specify
a background pixmap of "<none>" in an RC file.

Without this change, there is no way to set a background
on every widget except, say, Text widgets. Which is bad,
since setting a background pixmap on text widgets slows
them down a lot.

This change does not change any public API's, so will
cause no compatibily problems, and is simple enough
so I don't think it will introduce new bugs.

                                        Owen

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.923
diff -u -r1.923 ChangeLog
--- ChangeLog	1999/01/17 16:51:16	1.923
+++ ChangeLog	1999/01/17 17:05:48
@@ -1,3 +1,11 @@
+Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
+
+	* gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
+	of "<none>", as there was no way to set the background
+	on all widget but some widgets. This is important
+	because Text widgets with background images are
+	slow and possibly ugly.
+
 Sun Jan 17 11:51:17 1999  Owen Taylor  <otaylor@gtk.org>
 
 	* gtk/gtktext.c (gtk_text_move_cursor): Fix typo
Index: gtk/gtkrc.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrc.c,v
retrieving revision 1.36
diff -u -r1.36 gtkrc.c
--- gtkrc.c	1999/01/15 18:41:38	1.36
+++ gtkrc.c	1999/01/17 17:06:03
@@ -1120,6 +1120,14 @@
 	  tmp_styles = tmp_styles->next;
 	}
 
+      for (i=0; i<5; i++)
+	if (proto_style->bg_pixmap_name[i] &&
+	    (strcmp (proto_style->bg_pixmap_name[i], "<none>") == 0))
+	  {
+	    g_free (proto_style->bg_pixmap_name[i]);
+	    proto_style->bg_pixmap_name[i] = NULL;
+	  }
+
       style = gtk_rc_style_to_style (proto_style);
 
       g_hash_table_insert (realized_style_ht, rc_styles, style);
@@ -1467,7 +1475,8 @@
   if (token != G_TOKEN_STRING)
     return G_TOKEN_STRING;
   
-  if (strcmp (scanner->value.v_string, "<parent>") == 0)
+  if ((strcmp (scanner->value.v_string, "<parent>") == 0) ||
+      (strcmp (scanner->value.v_string, "<none>") == 0))
     pixmap_file = g_strdup (scanner->value.v_string);
   else
     pixmap_file = gtk_rc_find_pixmap_in_path (scanner, scanner->value.v_string);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]