[gnome-shell/wip/resource-scale: 3/7] StIcon: Add resource-scale support
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/resource-scale: 3/7] StIcon: Add resource-scale support
- Date: Mon, 31 Jul 2017 12:38:26 +0000 (UTC)
commit 9e1962948a4fafea38fb493f50abb09ee8b06572
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu May 11 12:35:09 2017 +0800
StIcon: Add resource-scale support
This commit adds support for scaling the StIcon resource (the icon
texture) according to the resource scale.
src/st/st-icon.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index c5a06ed..6725941 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -207,6 +207,12 @@ st_icon_style_changed (StWidget *widget)
}
static void
+st_icon_resource_scale_changed (StWidget *widget)
+{
+ st_icon_update (ST_ICON (widget));
+}
+
+static void
st_icon_class_init (StIconClass *klass)
{
GParamSpec *pspec;
@@ -222,6 +228,7 @@ st_icon_class_init (StIconClass *klass)
actor_class->paint = st_icon_paint;
widget_class->style_changed = st_icon_style_changed;
+ widget_class->resource_scale_changed = st_icon_resource_scale_changed;
pspec = g_param_spec_object ("gicon",
"GIcon",
@@ -320,6 +327,8 @@ st_icon_finish_update (StIcon *icon)
g_signal_connect_object (priv->icon_texture, "pixbuf-change",
G_CALLBACK (on_pixbuf_changed), icon, 0);
}
+
+ clutter_actor_queue_relayout (CLUTTER_ACTOR (icon));
}
static void
@@ -342,9 +351,10 @@ st_icon_update (StIcon *icon)
StIconPrivate *priv = icon->priv;
StThemeNode *theme_node;
StTextureCache *cache;
- gint scale;
+ gint paint_scale;
ClutterActor *stage;
StThemeContext *context;
+ float resource_scale;
if (priv->pending_texture)
{
@@ -354,13 +364,16 @@ st_icon_update (StIcon *icon)
priv->opacity_handler_id = 0;
}
+ if (!st_widget_get_resource_scale (ST_WIDGET (icon), &resource_scale))
+ return;
+
theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
if (theme_node == NULL)
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", &scale, NULL);
+ g_object_get (context, "scale-factor", &paint_scale, NULL);
cache = st_texture_cache_get_default ();
@@ -369,16 +382,16 @@ st_icon_update (StIcon *icon)
theme_node,
priv->gicon,
priv->icon_size,
- scale,
- 1);
+ paint_scale,
+ resource_scale);
if (priv->pending_texture == NULL && priv->fallback_gicon != NULL)
priv->pending_texture = st_texture_cache_load_gicon (cache,
theme_node,
priv->fallback_gicon,
priv->icon_size,
- scale,
- 1);
+ paint_scale,
+ resource_scale);
if (priv->pending_texture)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]