st-texture-cache: use StImageContent for cairo bound surface

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
This commit is contained in:
Marco Trevisan (Treviño) 2019-03-01 06:56:26 +01:00 committed by Jonas Ådahl
parent e3c5c9a2e7
commit 19c60ff5c5
4 changed files with 14 additions and 7 deletions

View File

@ -94,7 +94,9 @@ var CtrlAltTabManager = class CtrlAltTabManager {
if (app) if (app)
icon = app.create_icon_texture(POPUP_APPICON_SIZE); icon = app.create_icon_texture(POPUP_APPICON_SIZE);
else 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, items.push({ name: windows[i].title,

View File

@ -211,8 +211,8 @@ window_backed_app_get_icon (ShellApp *app,
actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (), actor = st_texture_cache_bind_cairo_surface_property (st_texture_cache_get_default (),
G_OBJECT (window), G_OBJECT (window),
"icon"); "icon",
g_object_set (actor, "width", (float) size, "height", (float) size, NULL); size);
return actor; return actor;
} }

View File

@ -679,6 +679,7 @@ load_texture_async (StTextureCache *cache,
typedef struct { typedef struct {
StTextureCache *cache; StTextureCache *cache;
ClutterActor *actor; ClutterActor *actor;
gint size;
GObject *source; GObject *source;
guint notify_signal_id; guint notify_signal_id;
gboolean weakref_active; gboolean weakref_active;
@ -702,7 +703,7 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
image = clutter_actor_get_content (bind->actor); image = clutter_actor_get_content (bind->actor);
if (!image || !CLUTTER_IS_IMAGE (image)) if (!image || !CLUTTER_IS_IMAGE (image))
image = clutter_image_new (); image = st_image_content_new_with_preferred_size (bind->size, bind->size);
else else
g_object_ref (image); g_object_ref (image);
@ -771,17 +772,20 @@ st_texture_cache_free_bind (gpointer data)
ClutterActor * ClutterActor *
st_texture_cache_bind_cairo_surface_property (StTextureCache *cache, st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
GObject *object, GObject *object,
const char *property_name) const char *property_name,
gint size)
{ {
ClutterActor *actor; ClutterActor *actor;
gchar *notify_key; gchar *notify_key;
StTextureCachePropertyBind *bind; StTextureCachePropertyBind *bind;
actor = clutter_actor_new (); actor = create_invisible_actor ();
clutter_actor_set_size (actor, size, size);
bind = g_new0 (StTextureCachePropertyBind, 1); bind = g_new0 (StTextureCachePropertyBind, 1);
bind->cache = cache; bind->cache = cache;
bind->actor = actor; bind->actor = actor;
bind->size = size;
bind->source = object; bind->source = object;
g_object_weak_ref (G_OBJECT (actor), st_texture_cache_bind_weak_notify, bind); g_object_weak_ref (G_OBJECT (actor), st_texture_cache_bind_weak_notify, bind);
bind->weakref_active = TRUE; bind->weakref_active = TRUE;

View File

@ -65,7 +65,8 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache, ClutterActor *st_texture_cache_bind_cairo_surface_property (StTextureCache *cache,
GObject *object, GObject *object,
const char *property_name); const char *property_name,
gint size);
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache, ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,
StThemeNode *theme_node, StThemeNode *theme_node,