From 966d4b164cbc308316fbcb875853a1d4e3487b2e Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 3 Apr 2020 19:00:28 -0300 Subject: [PATCH] st/theme-context: Invalidate texture cache when scaling changes --- src/st/st-texture-cache.c | 15 +++++++++++++++ src/st/st-texture-cache.h | 2 ++ src/st/st-theme-context.c | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 850c0d697..2c9319980 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -1619,3 +1619,18 @@ st_texture_cache_rescan_icon_theme (StTextureCache *cache) return gtk_icon_theme_rescan_if_needed (priv->icon_theme); } + + +/** + * st_texture_cache_invalidate: + * @cache: a #StTextureCache + * + * Invalidates the texture cache, and evicts all icons. + */ +void +st_texture_cache_invalidate (StTextureCache *cache) +{ + g_return_if_fail (ST_IS_TEXTURE_CACHE (cache)); + + st_texture_cache_evict_icons (cache); +} diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h index a99316da8..031087d87 100644 --- a/src/st/st-texture-cache.h +++ b/src/st/st-texture-cache.h @@ -115,4 +115,6 @@ CoglTexture * st_texture_cache_load (StTextureCache *cache, gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache); +void st_texture_cache_invalidate (StTextureCache *cache); + #endif /* __ST_TEXTURE_CACHE_H__ */ diff --git a/src/st/st-theme-context.c b/src/st/st-theme-context.c index de112aa49..b21d5de96 100644 --- a/src/st/st-theme-context.c +++ b/src/st/st-theme-context.c @@ -176,7 +176,11 @@ st_theme_context_set_property (GObject *object, int scale_factor = g_value_get_int (value); if (scale_factor != context->scale_factor) { + StTextureCache *cache = st_texture_cache_get_default (); + context->scale_factor = scale_factor; + + st_texture_cache_invalidate (cache); st_theme_context_changed (context); }