diff --git a/src/st/st-icon.c b/src/st/st-icon.c index c43d7c91b..c54fe9d72 100644 --- a/src/st/st-icon.c +++ b/src/st/st-icon.c @@ -334,7 +334,9 @@ st_icon_init (StIcon *self) CLUTTER_BIN_ALIGNMENT_FILL); clutter_actor_set_layout_manager (CLUTTER_ACTOR (self), layout_manager); - self->priv->icon_size = DEFAULT_ICON_SIZE; + /* Set the icon size to -1 here to make sure we apply the scale to the + * default size on the first "style-changed" signal. */ + self->priv->icon_size = -1; self->priv->prop_icon_size = -1; self->priv->shadow_pipeline = NULL; @@ -462,6 +464,9 @@ st_icon_update (StIcon *icon) if (theme_node == NULL) return; + if (priv->icon_size <= 0) + return; + stage = clutter_actor_get_stage (CLUTTER_ACTOR (icon)); context = st_theme_context_get_for_stage (CLUTTER_STAGE (stage)); g_object_get (context, "scale-factor", &paint_scale, NULL); @@ -472,7 +477,7 @@ st_icon_update (StIcon *icon) priv->pending_texture = st_texture_cache_load_gicon (cache, theme_node, priv->gicon, - priv->icon_size, + priv->icon_size / paint_scale, paint_scale, resource_scale); @@ -480,7 +485,7 @@ st_icon_update (StIcon *icon) priv->pending_texture = st_texture_cache_load_gicon (cache, theme_node, priv->fallback_gicon, - priv->icon_size, + priv->icon_size / paint_scale, paint_scale, resource_scale); @@ -488,7 +493,7 @@ st_icon_update (StIcon *icon) priv->pending_texture = st_texture_cache_load_gicon (cache, theme_node, default_gicon, - priv->icon_size, + priv->icon_size / paint_scale, paint_scale, resource_scale); @@ -519,34 +524,31 @@ st_icon_update_icon_size (StIcon *icon) { StIconPrivate *priv = icon->priv; int new_size; + gint scale = 1; + ClutterActor *stage; + StThemeContext *context; - if (priv->prop_icon_size > 0) - new_size = priv->prop_icon_size; - else if (priv->theme_icon_size > 0) + stage = clutter_actor_get_stage (CLUTTER_ACTOR (icon)); + if (stage != NULL) { - gint scale; - ClutterActor *stage; - StThemeContext *context; - - /* The theme will give us an already-scaled size, so we - * undo it here, as priv->icon_size is in unscaled pixels. - */ - stage = clutter_actor_get_stage (CLUTTER_ACTOR (icon)); context = st_theme_context_get_for_stage (CLUTTER_STAGE (stage)); g_object_get (context, "scale-factor", &scale, NULL); - new_size = (gint) (priv->theme_icon_size / scale); } + + if (priv->prop_icon_size > 0) + new_size = priv->prop_icon_size * scale; + else if (priv->theme_icon_size > 0) + new_size = priv->theme_icon_size; else - new_size = DEFAULT_ICON_SIZE; + new_size = DEFAULT_ICON_SIZE * scale; if (new_size != priv->icon_size) { - clutter_actor_queue_relayout (CLUTTER_ACTOR (icon)); priv->icon_size = new_size; return TRUE; } - else - return FALSE; + + return FALSE; } /**