[gnome-shell/wip/fmuellner/window-app-icon-size: 2/4] texture-cache: Fall back to actor size for bound textures



commit d86d3bbe54348d17e5a2e81896f6a74019877cb6
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 8 14:08:27 2019 +0100

    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

 src/st/st-texture-cache.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index fa5b1f04a..61f76accc 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]