[mutter/gbsneto/content: 1/5] wayland/actor-surface: Set geometry scale in surface actor



commit 6cac5e3d6ad33aa56f63ee5a4d13b209e12cffdd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 9 12:29:37 2019 -0300

    wayland/actor-surface: Set geometry scale in surface actor
    
    Now that MetaShapedTexture is a ClutterContent implemetation that
    is aware of its own buffer scale, it is possible to simplify the
    event translation routines.
    
    Set the geometry scale in MetaSurfaceActor, and stop adjusting the
    surface scale when translating points. Also remove the now obsoleted
    meta_wayland_actor_surface_calculate_scale() function.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/409

 src/wayland/meta-wayland-actor-surface.c | 18 +++---------------
 src/wayland/meta-wayland-actor-surface.h |  2 --
 src/wayland/meta-wayland-shell-surface.c | 11 ++---------
 src/wayland/meta-wayland-surface.c       |  2 --
 4 files changed, 5 insertions(+), 28 deletions(-)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 979422bae..8e5e65461 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -128,21 +128,6 @@ meta_wayland_actor_surface_get_geometry_scale (MetaWaylandActorSurface *actor_su
     }
 }
 
-double
-meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface)
-{
-  MetaWaylandSurfaceRole *surface_role =
-    META_WAYLAND_SURFACE_ROLE (actor_surface);
-  MetaWaylandSurface *surface =
-    meta_wayland_surface_role_get_surface (surface_role);
-  double geometry_scale;
-
-  geometry_scale =
-    meta_wayland_actor_surface_get_geometry_scale (actor_surface);
-
-  return geometry_scale / (double) surface->scale;
-}
-
 static void
 meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor_surface)
 {
@@ -164,6 +149,9 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
 
   /* Wayland surface coordinate space -> stage coordinate space */
   geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_surface);
+  clutter_actor_set_scale (CLUTTER_ACTOR (surface_actor),
+                           geometry_scale,
+                           geometry_scale);
 
   surface_rect = (cairo_rectangle_int_t) {
     .width = meta_wayland_surface_get_width (surface) * geometry_scale,
diff --git a/src/wayland/meta-wayland-actor-surface.h b/src/wayland/meta-wayland-actor-surface.h
index 444b3b178..6c6a1efff 100644
--- a/src/wayland/meta-wayland-actor-surface.h
+++ b/src/wayland/meta-wayland-actor-surface.h
@@ -38,8 +38,6 @@ struct _MetaWaylandActorSurfaceClass
 
 void meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface);
 
-double meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface);
-
 MetaSurfaceActor * meta_wayland_actor_surface_get_actor (MetaWaylandActorSurface *actor_surface);
 void meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface);
 
diff --git a/src/wayland/meta-wayland-shell-surface.c b/src/wayland/meta-wayland-shell-surface.c
index f8354ab7c..6f7e1ff27 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -146,15 +146,11 @@ static void
 meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole  *surface_role,
                                            MetaWaylandPendingState *pending)
 {
-  MetaWaylandActorSurface *actor_surface =
-    META_WAYLAND_ACTOR_SURFACE (surface_role);
   MetaWaylandSurface *surface =
     meta_wayland_surface_role_get_surface (surface_role);
   MetaWaylandSurfaceRoleClass *surface_role_class;
   MetaWindow *window;
   MetaWaylandBuffer *buffer;
-  CoglTexture *texture;
-  double scale;
 
   surface_role_class =
     META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
@@ -168,11 +164,8 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole  *surface_role
   if (!window)
     return;
 
-  scale = meta_wayland_actor_surface_calculate_scale (actor_surface);
-  texture = meta_wayland_surface_get_texture (surface);
-
-  window->buffer_rect.width = cogl_texture_get_width (texture) * scale;
-  window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
+  window->buffer_rect.width = meta_wayland_surface_get_width (surface);
+  window->buffer_rect.height = meta_wayland_surface_get_height (surface);
 }
 
 static void
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index f9cc118b6..787265f33 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1584,8 +1584,6 @@ meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
         CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
 
       clutter_actor_transform_stage_point (actor, abs_x, abs_y, sx, sy);
-      *sx /= surface->scale;
-      *sy /= surface->scale;
     }
 }
 


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