[gnome-shell/wip/fmuellner/update-tex-size] texture-cache: Update size after setting content
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/update-tex-size] texture-cache: Update size after setting content
- Date: Sat, 9 Feb 2019 18:35:54 +0000 (UTC)
commit d2a00f6a75d8c6d57cd16e7b2ce72b652e52799d
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Feb 9 19:16:15 2019 +0100
texture-cache: Update size after setting content
Since commit deec0bf2550, the texture cache is based on ClutterImage
rather than ClutterTexture. As ClutterImage (like all ClutterContent)
is only concerned with painting, it doesn't influence the size of the
actor it is added to at all.
That is, unlike with the previous code, the returned actor will now
stay at size (0, 0) after the image has been loaded. We'll need to
either update all consumers to listent to :content changes, or update
the size when setting the content.
The latter looks like the friendlier approach, and should be more in
line what we used to do.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/402
src/st/st-texture-cache.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 1d11ce71c..bec484c88 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -79,10 +79,15 @@ static void
set_content_from_image (ClutterActor *actor,
ClutterContent *image)
{
+ float width, height;
+
g_assert (image && CLUTTER_IS_IMAGE (image));
+ clutter_content_get_preferred_size (image, &width, &height);
+
clutter_actor_set_content (actor, image);
clutter_actor_set_opacity (actor, 255);
+ clutter_actor_set_size (actor, width, height);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]