From 19c60ff5c52fc866ad3c24c7bd6065e8b28df3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 1 Mar 2019 06:56:26 +0100 Subject: [PATCH] st-texture-cache: use StImageContent for cairo bound surface https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5 --- js/ui/ctrlAltTab.js | 4 +++- src/shell-app.c | 4 ++-- src/st/st-texture-cache.c | 10 +++++++--- src/st/st-texture-cache.h | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js index 146f8ead9..338080fc4 100644 --- a/js/ui/ctrlAltTab.js +++ b/js/ui/ctrlAltTab.js @@ -94,7 +94,9 @@ var CtrlAltTabManager = class CtrlAltTabManager { if (app) icon = app.create_icon_texture(POPUP_APPICON_SIZE); else - icon = textureCache.bind_cairo_surface_property(windows[i], 'icon'); + icon = textureCache.bind_cairo_surface_property(windows[i], + 'icon', + POPUP_APPICON_SIZE); } items.push({ name: windows[i].title, diff --git a/src/shell-app.c b/src/shell-app.c index 5a0f81d52..3f91613fa 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -211,8 +211,8 @@ window_backed_app_get_icon (ShellApp *app, 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); + "icon", + size); return actor; } diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index ae5ac09cb..6da186fba 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -679,6 +679,7 @@ load_texture_async (StTextureCache *cache, typedef struct { StTextureCache *cache; ClutterActor *actor; + gint size; GObject *source; guint notify_signal_id; gboolean weakref_active; @@ -702,7 +703,7 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind, image = clutter_actor_get_content (bind->actor); if (!image || !CLUTTER_IS_IMAGE (image)) - image = clutter_image_new (); + image = st_image_content_new_with_preferred_size (bind->size, bind->size); else g_object_ref (image); @@ -771,17 +772,20 @@ st_texture_cache_free_bind (gpointer data) ClutterActor * st_texture_cache_bind_cairo_surface_property (StTextureCache *cache, GObject *object, - const char *property_name) + const char *property_name, + gint size) { ClutterActor *actor; gchar *notify_key; StTextureCachePropertyBind *bind; - actor = clutter_actor_new (); + actor = create_invisible_actor (); + clutter_actor_set_size (actor, size, size); bind = g_new0 (StTextureCachePropertyBind, 1); bind->cache = cache; bind->actor = actor; + bind->size = size; bind->source = object; g_object_weak_ref (G_OBJECT (actor), st_texture_cache_bind_weak_notify, bind); bind->weakref_active = TRUE; diff --git a/src/st/st-texture-cache.h b/src/st/st-texture-cache.h index 0e0202c50..a3311a862 100644 --- a/src/st/st-texture-cache.h +++ b/src/st/st-texture-cache.h @@ -65,7 +65,8 @@ st_texture_cache_load_sliced_image (StTextureCache *cache, ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache, GObject *object, - const char *property_name); + const char *property_name, + gint size); ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache, StThemeNode *theme_node,