File gnome-shell-st-Do-not-force-allocation-updates-during-shadow-creation.patch of Package gnome-shell.10387

From f6a08472a0fef65f965c7d822f0a24f807e21f0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Fri, 23 Feb 2018 17:29:54 +0100
Subject: [PATCH] st: Do not force allocation updates during shadow creation

If an actor is pending a relayout when get_allocation_box() is called,
the method forces an allocation update. In case of StWidget, this might
then result in a style update and a consecutive invalidation of the
shadow spec.

A helper method that invalidates one of its parameters as a side effect
(and by extension its return value as well) is most unexpected, so cur-
rently _st_create_shadow_pipeline_from_actor() poses an easy trap to
callers to run into.

Remove that trap by calling get_size()/get_position() instead, which
don't have the unintended side effect - it is still a good idea to fix
callers who were running into this to not waste resources on creating
shadows that are invalidated before the next paint, but throwing un-
defined behavior at them is harsh ...

https://bugzilla.gnome.org/show_bug.cgi?id=788908
---
 src/st/st-private.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/st/st-private.c b/src/st/st-private.c
index be78833e7..2bdc29b6c 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -414,11 +414,9 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
                                        ClutterActor *actor)
 {
   CoglPipeline *shadow_pipeline = NULL;
-  ClutterActorBox box;
   float width, height;
 
-  clutter_actor_get_allocation_box (actor, &box);
-  clutter_actor_box_get_size (&box, &width, &height);
+  clutter_actor_get_size (actor, &width, &height);
 
   if (width == 0 || height == 0)
     return NULL;
@@ -441,6 +439,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       CoglFramebuffer *fb;
       CoglColor clear_color;
       CoglError *catch_error = NULL;
+      float x, y;
 
       buffer = cogl_texture_new_with_size (width,
                                            height,
@@ -462,6 +461,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
         }
 
       cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
+      clutter_actor_get_position (actor, &x, &y);
 
       /* XXX: There's no way to render a ClutterActor to an offscreen
        * as it uses the implicit API. */
@@ -470,7 +470,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       G_GNUC_END_IGNORE_DEPRECATIONS;
 
       cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR, &clear_color);
-      cogl_framebuffer_translate (fb, -box.x1, -box.y1, 0);
+      cogl_framebuffer_translate (fb, -x, -y, 0);
       cogl_framebuffer_orthographic (fb, 0, 0, width, height, 0, 1.0);
 
       clutter_actor_set_opacity_override (actor, 255);
-- 
2.16.4
openSUSE Build Service is sponsored by