[gnome-shell] st/texture-cache: Ensure icons keep their aspect ratio when scaled down
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st/texture-cache: Ensure icons keep their aspect ratio when scaled down
- Date: Sun, 14 Mar 2021 01:11:26 +0000 (UTC)
commit 5062c4c9c2c960bf8edf70aa95dc6fca53088f03
Author: Sebastian Keller <skeller gnome org>
Date: Wed Mar 10 17:27:42 2021 +0100
st/texture-cache: Ensure icons keep their aspect ratio when scaled down
Window preview icons can get scaled down if the window they belong to is
very small and/or there are a lot of open windows. When scaled down this
way the icons would get scaled without keeping the aspect ratio. Fix
this by using a content gravity that keeps the aspect ratio.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3865
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1751>
src/st/st-texture-cache.c | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 0ed3df5e76..178acbb5dc 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -983,6 +983,7 @@ st_texture_cache_load_gicon (StTextureCache *cache,
if (ST_IS_IMAGE_CONTENT (icon))
{
return g_object_new (CLUTTER_TYPE_ACTOR,
+ "content-gravity", CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT,
"width", actor_size,
"height", actor_size,
"content", CLUTTER_CONTENT (icon),
@@ -1037,6 +1038,7 @@ st_texture_cache_load_gicon (StTextureCache *cache,
g_free (gicon_string);
actor = create_invisible_actor ();
+ clutter_actor_set_content_gravity (actor, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
clutter_actor_set_size (actor, actor_size, actor_size);
if (!ensure_request (cache, key, policy, &request, actor))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]