[gtk/fix-icontheme-invalidation: 1/9] css: Compare icon theme serials
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-icontheme-invalidation: 1/9] css: Compare icon theme serials
- Date: Wed, 22 Apr 2020 22:00:18 +0000 (UTC)
commit a16dded5abb6ec13cc6c9a02e0e761c2dadf128e
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Apr 22 13:49:18 2020 -0400
css: Compare icon theme serials
When comparing to icon theme image values for equality,
take the serial of the icon theme at compute time into
account.
gtk/gtkcssimageicontheme.c | 4 +++-
gtk/gtkcssimageiconthemeprivate.h | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 08fd70a61f..93cdf09d6e 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -153,6 +153,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
settings = gtk_style_provider_get_settings (provider);
display = _gtk_settings_get_display (settings);
copy->icon_theme = gtk_icon_theme_get_for_display (display);
+ copy->serial = gtk_icon_theme_get_serial (copy->icon_theme);
copy->scale = gtk_style_provider_get_scale (provider);
gtk_icon_theme_lookup_symbolic_colors (style, ©->color, ©->success, ©->warning, ©->error);
@@ -166,7 +167,8 @@ gtk_css_image_icon_theme_equal (GtkCssImage *image1,
GtkCssImageIconTheme *icon_theme1 = (GtkCssImageIconTheme *) image1;
GtkCssImageIconTheme *icon_theme2 = (GtkCssImageIconTheme *) image2;
- return g_str_equal (icon_theme1->name, icon_theme2->name);
+ return icon_theme1->serial == icon_theme2->serial &&
+ g_str_equal (icon_theme1->name, icon_theme2->name);
}
static void
diff --git a/gtk/gtkcssimageiconthemeprivate.h b/gtk/gtkcssimageiconthemeprivate.h
index 02fd2046fd..5b1540d413 100644
--- a/gtk/gtkcssimageiconthemeprivate.h
+++ b/gtk/gtkcssimageiconthemeprivate.h
@@ -44,7 +44,8 @@ struct _GtkCssImageIconTheme
GdkRGBA success;
GdkRGBA warning;
GdkRGBA error;
- gint scale;
+ int serial;
+ int scale;
char *name;
int cached_size;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]