st/theme-context: Invalidate texture cache when scaling changes

This commit is contained in:
Georges Basile Stavracas Neto 2020-04-03 19:00:28 -03:00
parent a3cf41734a
commit 966d4b164c
3 changed files with 21 additions and 0 deletions

View File

@ -1619,3 +1619,18 @@ st_texture_cache_rescan_icon_theme (StTextureCache *cache)
return gtk_icon_theme_rescan_if_needed (priv->icon_theme); 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);
}

View File

@ -115,4 +115,6 @@ CoglTexture * st_texture_cache_load (StTextureCache *cache,
gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache); gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache);
void st_texture_cache_invalidate (StTextureCache *cache);
#endif /* __ST_TEXTURE_CACHE_H__ */ #endif /* __ST_TEXTURE_CACHE_H__ */

View File

@ -176,7 +176,11 @@ st_theme_context_set_property (GObject *object,
int scale_factor = g_value_get_int (value); int scale_factor = g_value_get_int (value);
if (scale_factor != context->scale_factor) if (scale_factor != context->scale_factor)
{ {
StTextureCache *cache = st_texture_cache_get_default ();
context->scale_factor = scale_factor; context->scale_factor = scale_factor;
st_texture_cache_invalidate (cache);
st_theme_context_changed (context); st_theme_context_changed (context);
} }