[mutter/gbsneto/clutter-cleanups-part1: 4/22] clutter/actor: Drop depth property and functions



commit 387a13f0ab5978b169c2e93f32145eda4c70271c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jun 26 13:59:11 2020 -0300

    clutter/actor: Drop depth property and functions
    
    It is deprecated in favor of the 'z-position' property, and
    the implementation itself redirects to the z-position, so
    just drop it and replace all get|set_depth calls to their
    z-position counterparts.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332

 clutter/clutter/clutter-actor.c                    | 115 +--------------------
 clutter/clutter/deprecated/clutter-actor.h         |   7 --
 clutter/clutter/deprecated/clutter-group.c         |  12 +--
 .../accessibility/cally-atkcomponent-example.c     |   2 +-
 src/tests/clutter/conform/group.c                  |   6 +-
 5 files changed, 12 insertions(+), 130 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 01a238274f..86e8478fd5 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -254,7 +254,7 @@
  *
  * // animate the actor's opacity and depth
  * clutter_actor_set_opacity (actor, 0);
- * clutter_actor_set_depth (actor, -100);
+ * clutter_actor_set_z_position (actor, -100);
  *
  * clutter_actor_restore_easing_state (actor);
  *
@@ -262,7 +262,7 @@
  *
  * // animate another actor's opacity
  * clutter_actor_set_opacity (another_actor, 255);
- * clutter_actor_set_depth (another_actor, 100);
+ * clutter_actor_set_z_position (another_actor, 100);
  *
  * clutter_actor_restore_easing_state (another_actor);
  * ]|
@@ -905,7 +905,6 @@ enum
   /* Allocation properties are read-only */
   PROP_ALLOCATION,
 
-  PROP_DEPTH, /* XXX:2.0 remove */
   PROP_Z_POSITION,
 
   PROP_CLIP_RECT,
@@ -5229,10 +5228,6 @@ clutter_actor_set_property (GObject      *object,
       clutter_actor_set_request_mode (actor, g_value_get_enum (value));
       break;
 
-    case PROP_DEPTH: /* XXX:2.0 - remove */
-      clutter_actor_set_depth (actor, g_value_get_float (value));
-      break;
-
     case PROP_Z_POSITION:
       clutter_actor_set_z_position (actor, g_value_get_float (value));
       break;
@@ -5617,10 +5612,6 @@ clutter_actor_get_property (GObject    *object,
       g_value_set_boxed (value, &priv->allocation);
       break;
 
-    case PROP_DEPTH: /* XXX:2.0 - remove */
-      g_value_set_float (value, clutter_actor_get_depth (actor));
-      break;
-
     case PROP_Z_POSITION:
       g_value_set_float (value, clutter_actor_get_z_position (actor));
       break;
@@ -6865,34 +6856,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
                        CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
                        CLUTTER_PARAM_READWRITE);
 
-  /**
-   * ClutterActor:depth:
-   *
-   * The position of the actor on the Z axis.
-   *
-   * The #ClutterActor:depth property is relative to the parent's
-   * modelview matrix.
-   *
-   * Setting this property will call #ClutterContainerIface.sort_depth_order()
-   * which is usually a no-op, and it's most likely not what you want.
-   *
-   * The #ClutterActor:depth property is animatable.
-   *
-   * Since: 0.6
-   *
-   * Deprecated: 1.12: Use #ClutterActor:z-position instead.
-   */
-  obj_props[PROP_DEPTH] =
-    g_param_spec_float ("depth",
-                        P_("Depth"),
-                        P_("Position on the Z axis"),
-                        -G_MAXFLOAT, G_MAXFLOAT,
-                        0.0,
-                        G_PARAM_READWRITE |
-                        G_PARAM_STATIC_STRINGS |
-                        G_PARAM_DEPRECATED |
-                        CLUTTER_PARAM_ANIMATABLE);
-
   /**
    * ClutterActor:z-position:
    *
@@ -11980,32 +11943,6 @@ clutter_actor_get_name (ClutterActor *self)
   return self->priv->name;
 }
 
-static inline void
-clutter_actor_set_depth_internal (ClutterActor *self,
-                                  float         depth)
-{
-  ClutterTransformInfo *info;
-
-  info = _clutter_actor_get_transform_info (self);
-
-  if (info->z_position != depth)
-    {
-      /* Sets Z value - XXX 2.0: should we invert? */
-      info->z_position = depth;
-
-      self->priv->transform_valid = FALSE;
-
-      /* FIXME - remove this crap; sadly, there are still containers
-       * in Clutter that depend on this utter brain damage
-       */
-      clutter_container_sort_depth_order (CLUTTER_CONTAINER (self));
-
-      clutter_actor_queue_redraw (self);
-
-      g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_DEPTH]);
-    }
-}
-
 static inline void
 clutter_actor_set_z_position_internal (ClutterActor *self,
                                        float         z_position)
@@ -12173,50 +12110,6 @@ clutter_actor_get_pivot_point_z (ClutterActor *self)
   return _clutter_actor_get_transform_info_or_defaults (self)->pivot_z;
 }
 
-/**
- * clutter_actor_set_depth:
- * @self: a #ClutterActor
- * @depth: Z co-ord
- *
- * Sets the Z coordinate of @self to @depth.
- *
- * The unit used by @depth is dependant on the perspective setup. See
- * also clutter_stage_set_perspective().
- *
- * Deprecated: 1.12: Use clutter_actor_set_z_position() instead.
- */
-void
-clutter_actor_set_depth (ClutterActor *self,
-                         gfloat        depth)
-{
-  const ClutterTransformInfo *info;
-
-  g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
-  info = _clutter_actor_get_transform_info_or_defaults (self);
-  _clutter_actor_create_transition (self, obj_props[PROP_DEPTH],
-                                    info->z_position,
-                                    depth);
-}
-
-/**
- * clutter_actor_get_depth:
- * @self: a #ClutterActor
- *
- * Retrieves the depth of @self.
- *
- * Return value: the depth of the actor
- *
- * Deprecated: 1.12: Use clutter_actor_get_z_position() instead.
- */
-gfloat
-clutter_actor_get_depth (ClutterActor *self)
-{
-  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.0);
-
-  return _clutter_actor_get_transform_info_or_defaults (self)->z_position;
-}
-
 /**
  * clutter_actor_set_rotation:
  * @self: a #ClutterActor
@@ -14834,10 +14727,6 @@ clutter_actor_set_animatable_property (ClutterActor *actor,
       clutter_actor_queue_redraw (actor);
       break;
 
-    case PROP_DEPTH:
-      clutter_actor_set_depth_internal (actor, g_value_get_float (value));
-      break;
-
     case PROP_Z_POSITION:
       clutter_actor_set_z_position_internal (actor, g_value_get_float (value));
       break;
diff --git a/clutter/clutter/deprecated/clutter-actor.h b/clutter/clutter/deprecated/clutter-actor.h
index 1b447ea32b..de226caebd 100644
--- a/clutter/clutter/deprecated/clutter-actor.h
+++ b/clutter/clutter/deprecated/clutter-actor.h
@@ -52,13 +52,6 @@ void            clutter_actor_pop_internal                      (ClutterActor
 CLUTTER_DEPRECATED
 void            clutter_actor_show_all                          (ClutterActor          *self);
 
-CLUTTER_DEPRECATED_FOR(clutter_actor_set_z_position)
-void            clutter_actor_set_depth                         (ClutterActor          *self,
-                                                                 gfloat                 depth);
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_get_z_position)
-gfloat          clutter_actor_get_depth                         (ClutterActor          *self);
-
 CLUTTER_DEPRECATED_FOR(clutter_actor_set_rotation_angle)
 void            clutter_actor_set_rotation                      (ClutterActor          *self,
                                                                  ClutterRotateAxis      axis,
diff --git a/clutter/clutter/deprecated/clutter-group.c b/clutter/clutter/deprecated/clutter-group.c
index dce35cff80..08e5476e4f 100644
--- a/clutter/clutter/deprecated/clutter-group.c
+++ b/clutter/clutter/deprecated/clutter-group.c
@@ -84,8 +84,8 @@ static gint
 sort_by_depth (gconstpointer a,
                gconstpointer b)
 {
-  gfloat depth_a = clutter_actor_get_depth (CLUTTER_ACTOR(a));
-  gfloat depth_b = clutter_actor_get_depth (CLUTTER_ACTOR(b));
+  gfloat depth_a = clutter_actor_get_z_position (CLUTTER_ACTOR(a));
+  gfloat depth_b = clutter_actor_get_z_position (CLUTTER_ACTOR(b));
 
   if (depth_a < depth_b)
     return -1;
@@ -207,9 +207,9 @@ clutter_group_real_raise (ClutterContainer *container,
    * we can break API and remove Group for good.
    */
   if (sibling &&
-      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
+      clutter_actor_get_z_position (sibling) != clutter_actor_get_z_position (actor))
     {
-      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
+      clutter_actor_set_z_position (actor, clutter_actor_get_z_position (sibling));
     }
 
   clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
@@ -246,9 +246,9 @@ clutter_group_real_lower (ClutterContainer *container,
 
   /* See comment in group_raise for this */
   if (sibling &&
-      clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor))
+      clutter_actor_get_z_position (sibling) != clutter_actor_get_z_position (actor))
     {
-      clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling));
+      clutter_actor_set_z_position (actor, clutter_actor_get_z_position (sibling));
     }
 
   clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
diff --git a/src/tests/clutter/accessibility/cally-atkcomponent-example.c 
b/src/tests/clutter/accessibility/cally-atkcomponent-example.c
index 79a816bde3..cd46c2274f 100644
--- a/src/tests/clutter/accessibility/cally-atkcomponent-example.c
+++ b/src/tests/clutter/accessibility/cally-atkcomponent-example.c
@@ -63,7 +63,7 @@ main (int argc, char *argv[])
   button3 = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue);
   clutter_actor_set_position (button3, 0, 2 * SIZE);
   clutter_actor_set_size (button3, SIZE, SIZE);
-  clutter_actor_set_depth( button3, DEPTH);
+  clutter_actor_set_z_position (button3, DEPTH);
 
   /* a nested hierarchy, to check that the relative positions are
      computed properly */
diff --git a/src/tests/clutter/conform/group.c b/src/tests/clutter/conform/group.c
index a1eaf7eb7d..17036ee307 100644
--- a/src/tests/clutter/conform/group.c
+++ b/src/tests/clutter/conform/group.c
@@ -16,7 +16,7 @@ group_depth_sorting (void)
 
   child = clutter_rectangle_new ();
   clutter_actor_set_size (child, 20, 20);
-  clutter_actor_set_depth (child, 0);
+  clutter_actor_set_z_position (child, 0);
   clutter_actor_set_name (child, "zero");
   clutter_container_add_actor (CLUTTER_CONTAINER (group), child);
 
@@ -27,7 +27,7 @@ group_depth_sorting (void)
 
   child = clutter_rectangle_new ();
   clutter_actor_set_size (child, 20, 20);
-  clutter_actor_set_depth (child, 10);
+  clutter_actor_set_z_position (child, 10);
   clutter_actor_set_name (child, "plus-ten");
   clutter_container_add_actor (CLUTTER_CONTAINER (group), child);
 
@@ -39,7 +39,7 @@ group_depth_sorting (void)
 
   child = clutter_rectangle_new ();
   clutter_actor_set_size (child, 20, 20);
-  clutter_actor_set_depth (child, -10);
+  clutter_actor_set_z_position (child, -10);
   clutter_actor_set_name (child, "minus-ten");
   clutter_container_add_actor (CLUTTER_CONTAINER (group), child);
 


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