[mutter/gbsneto/content: 25/29] wayland-surface: Take shaped texture scale into account



commit 532d247c26b476e213997b95f40182c03c25eeef
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Apr 18 14:56:45 2019 -0300

    wayland-surface: Take shaped texture scale into account
    
    Back when MetaShapedTexture was a ClutterActor, the scale
    was set through ClutterActor.scale-{x,y} properties. Those
    properties, then, would be taken into account as part of
    the actor transform matrix, which would be used to figure
    out the results of clutter_actor_transform_stage_point().
    
    However, MetaShapedTexture is not a ClutterActor anymore,
    and tracks its scale independently. In fact, no other actor
    in the tree is scaled. That causes the relative transform
    to miss a very important field, and send the wrong input
    coordinates.
    
    Fix that by taking the shaped texture's scale into account
    again.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/409

 src/wayland/meta-wayland-surface.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index fee59b20a..f04758e9e 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1570,12 +1570,16 @@ meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
     }
   else
     {
-      ClutterActor *actor =
-        CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
+      MetaSurfaceActor *surface_actor =
+        meta_wayland_surface_get_actor (surface);
+      MetaShapedTexture *stex =
+        meta_surface_actor_get_texture (surface_actor);
+      ClutterActor *actor = CLUTTER_ACTOR (surface_actor);
+      double scale = meta_shaped_texture_get_scale (stex);
 
       clutter_actor_transform_stage_point (actor, abs_x, abs_y, sx, sy);
-      *sx /= surface->scale;
-      *sy /= surface->scale;
+      *sx /= surface->scale * scale;
+      *sy /= surface->scale * scale;
     }
 }
 


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