texture-cache: Fall back to actor size for bound textures
With StImageContent, the meaning of passing -1 as size parameter changed from "load the image at its preferred size" to "abort the session". It is therefore no longer possible to just load the image and then have it scaled by applying a CSS size to the texture's parent. Setting the size from CSS is useful though, so to still allow that, fall back to the actor's size (which can be determined by the style). https://gitlab.gnome.org/GNOME/gnome-shell/issues/1027
This commit is contained in:
@ -700,10 +700,14 @@ st_texture_cache_reset_texture (StTextureCachePropertyBind *bind,
|
||||
{
|
||||
g_autoptr(ClutterContent) image = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
int size = bind->size;
|
||||
|
||||
if (size < 0)
|
||||
clutter_actor_get_preferred_width (bind->actor, -1, NULL, (float *)&size);
|
||||
|
||||
image = clutter_actor_get_content (bind->actor);
|
||||
if (!image || !CLUTTER_IS_IMAGE (image))
|
||||
image = st_image_content_new_with_preferred_size (bind->size, bind->size);
|
||||
image = st_image_content_new_with_preferred_size (size, size);
|
||||
else
|
||||
g_object_ref (image);
|
||||
|
||||
|
Reference in New Issue
Block a user