[mutter/gbsneto/content: 78/84] wayland/actor-surface: Set geometry scale in surface actor



commit 2c1b94109f4f623ce71748a66edbc80e3ce602ef
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 | 20 ++++----------------
 src/wayland/meta-wayland-actor-surface.h |  4 +---
 src/wayland/meta-wayland-shell-surface.c | 12 ++++++------
 src/wayland/meta-wayland-surface.c       |  2 --
 4 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c
index 979422bae..bf964dcae 100644
--- a/src/wayland/meta-wayland-actor-surface.c
+++ b/src/wayland/meta-wayland-actor-surface.c
@@ -104,7 +104,7 @@ meta_wayland_actor_surface_queue_frame_callbacks (MetaWaylandActorSurface *actor
   wl_list_init (&pending->frame_callback_list);
 }
 
-static double
+double
 meta_wayland_actor_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
 {
   MetaWaylandSurfaceRole *surface_role =
@@ -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..aa9f8fa5a 100644
--- a/src/wayland/meta-wayland-actor-surface.h
+++ b/src/wayland/meta-wayland-actor-surface.h
@@ -37,9 +37,7 @@ struct _MetaWaylandActorSurfaceClass
 };
 
 void meta_wayland_actor_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface);
-
-double meta_wayland_actor_surface_calculate_scale (MetaWaylandActorSurface *actor_surface);
-
+double meta_wayland_actor_surface_get_geometry_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..3ebfdd284 100644
--- a/src/wayland/meta-wayland-shell-surface.c
+++ b/src/wayland/meta-wayland-shell-surface.c
@@ -153,8 +153,7 @@ meta_wayland_shell_surface_surface_commit (MetaWaylandSurfaceRole  *surface_role
   MetaWaylandSurfaceRoleClass *surface_role_class;
   MetaWindow *window;
   MetaWaylandBuffer *buffer;
-  CoglTexture *texture;
-  double scale;
+  double geometry_scale;
 
   surface_role_class =
     META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
@@ -168,11 +167,12 @@ 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);
+  geometry_scale = meta_wayland_actor_surface_get_geometry_scale (actor_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) * geometry_scale;
+  window->buffer_rect.height =
+    meta_wayland_surface_get_height (surface) * geometry_scale;
 }
 
 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]