Commit 2d371006 authored by Marco Trevisan's avatar Marco Trevisan 🎺

shell-app: use stage resource scale to create app icons

Since the icon is shared globally, we need to create it at the maximum scale
level for the current configuration, which the clutter stage scaling
represents.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
parent ecaf2e59
......@@ -196,16 +196,23 @@ window_backed_app_get_icon (ShellApp *app,
int size)
{
MetaWindow *window = NULL;
ClutterActor *stage;
ClutterActor *actor;
gint scale;
float scaled_size;
float max_scale;
ShellGlobal *global;
StThemeContext *context;
global = shell_global_get ();
context = st_theme_context_get_for_stage (shell_global_get_stage (global));
stage = shell_global_get_stage (global);
context = st_theme_context_get_for_stage (stage);
g_object_get (context, "scale-factor", &scale, NULL);
size *= scale;
scaled_size = size * scale;
if (clutter_actor_get_resource_scale (stage, &max_scale))
scaled_size *= max_scale;
/* During a state transition from running to not-running for
* window-backend apps, it's possible we get a request for the icon.
......@@ -217,14 +224,14 @@ window_backed_app_get_icon (ShellApp *app,
if (window == NULL)
{
actor = clutter_texture_new ();
g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
g_object_set (actor, "opacity", 0, "width", scaled_size, "height", scaled_size, NULL);
return actor;
}
actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
G_OBJECT (window),
"icon");
g_object_set (actor, "width", (float) size, "height", (float) size, NULL);
g_object_set (actor, "width", scaled_size, "height", scaled_size, NULL);
return actor;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment