]> Pileus Git - ~andy/gtk/commitdiff
When changing the icon theme, defer the resetting of rc styles to an idle,
authorMatthias Clasen <mclasen@redhat.com>
Fri, 12 Aug 2005 18:39:17 +0000 (18:39 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 12 Aug 2005 18:39:17 +0000 (18:39 +0000)
2005-08-12  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkicontheme.c: When changing the icon theme, defer
        the resetting of rc styles to an idle, so that it does
        not happen e.g during expose handling (which is problematic,
        since some widgets, like the toolbar, are changing the
        hierarchy in response to style changes).  (#300539, reported
        by many people, analyzed by Owen Taylor)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkicontheme.c

index 9ae69a9842ab3a40ab4b2584bae264abe2730faf..c686083406068940ecd839d30aeb94ee5d9cfc16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-08-12  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkicontheme.c: When changing the icon theme, defer
+       the resetting of rc styles to an idle, so that it does
+       not happen e.g during expose handling (which is problematic,
+       since some widgets, like the toolbar, are changing the
+       hierarchy in response to style changes).  (#300539, reported
+       by many people, analyzed by Owen Taylor)
+
 2005-08-12  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/linux-fb/gdkwindow-fb.c (gdk_window_set_back_pixmap)
index 9ae69a9842ab3a40ab4b2584bae264abe2730faf..c686083406068940ecd839d30aeb94ee5d9cfc16 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-12  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkicontheme.c: When changing the icon theme, defer
+       the resetting of rc styles to an idle, so that it does
+       not happen e.g during expose handling (which is problematic,
+       since some widgets, like the toolbar, are changing the
+       hierarchy in response to style changes).  (#300539, reported
+       by many people, analyzed by Owen Taylor)
+
 2005-08-12  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/linux-fb/gdkwindow-fb.c (gdk_window_set_back_pixmap)
index 9ae69a9842ab3a40ab4b2584bae264abe2730faf..c686083406068940ecd839d30aeb94ee5d9cfc16 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-12  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkicontheme.c: When changing the icon theme, defer
+       the resetting of rc styles to an idle, so that it does
+       not happen e.g during expose handling (which is problematic,
+       since some widgets, like the toolbar, are changing the
+       hierarchy in response to style changes).  (#300539, reported
+       by many people, analyzed by Owen Taylor)
+
 2005-08-12  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/linux-fb/gdkwindow-fb.c (gdk_window_set_back_pixmap)
index 8e36998fde99703de56eea6d4363b82aece47c53..eddfddf574d22133a4978094bbb3e614c26d06ae 100644 (file)
@@ -94,6 +94,8 @@ struct _GtkIconThemePrivate
   /* time when we last stat:ed for theme changes */
   long last_stat_time;
   GList *dir_mtimes;
+
+  gulong reset_styles_idle;
 };
 
 struct _GtkIconInfo
@@ -585,6 +587,30 @@ free_dir_mtime (IconThemeDirMtime *dir_mtime)
 
 }
 
+static gboolean
+reset_styles_idle (gpointer user_data)
+{
+  GtkIconTheme *icon_theme;
+  GtkIconThemePrivate *priv;
+
+  GDK_THREADS_ENTER ();
+
+  icon_theme = GTK_ICON_THEME (user_data);
+  priv = icon_theme->priv;
+
+  if (priv->screen && priv->is_screen_singleton)
+    {
+      GtkSettings *settings = gtk_settings_get_for_screen (priv->screen);
+      gtk_rc_reset_styles (settings);
+    }
+
+  priv->reset_styles_idle = 0;
+
+  GDK_THREADS_LEAVE ();
+
+  return FALSE;
+}
+
 static void
 do_theme_change (GtkIconTheme *icon_theme)
 {
@@ -594,12 +620,10 @@ do_theme_change (GtkIconTheme *icon_theme)
            g_print ("change to icon theme \"%s\"\n", priv->current_theme));
   blow_themes (icon_theme);
   g_signal_emit (icon_theme, signal_changed, 0);
-  
-  if (priv->screen && priv->is_screen_singleton)
-    {
-      GtkSettings *settings = gtk_settings_get_for_screen (priv->screen);
-      gtk_rc_reset_styles (settings);
-    }
+
+  if (!priv->reset_styles_idle)
+    priv->reset_styles_idle = 
+      g_idle_add (reset_styles_idle, icon_theme);
 }
 
 static void
@@ -633,6 +657,12 @@ gtk_icon_theme_finalize (GObject *object)
   icon_theme = GTK_ICON_THEME (object);
   priv = icon_theme->priv;
 
+  if (priv->reset_styles_idle)
+    {
+      g_source_remove (priv->reset_styles_idle);
+      priv->reset_styles_idle = 0;
+    }
+
   unset_screen (icon_theme);
 
   g_free (priv->current_theme);