[gtk/wip/baedert/for-master] fixedlayout: Don't call the child transform position



commit 73ebdcf6226e67da0999e01ecdfda5a861137d31
Author: Timm Bäder <mail baedert org>
Date:   Sun Aug 25 14:56:13 2019 +0200

    fixedlayout: Don't call the child transform position
    
    It's a full transform and not just a translation these days.

 gtk/gtkfixed.c       | 12 ++++++------
 gtk/gtkfixedlayout.c | 46 +++++++++++++++++++++++-----------------------
 gtk/gtkfixedlayout.h |  6 +++---
 3 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 2251c0bce1..dc6d34249c 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -164,7 +164,7 @@ gtk_fixed_put (GtkFixed  *fixed,
   child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
 
   transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (x, y));
-  gtk_fixed_layout_child_set_position (child_info, transform);
+  gtk_fixed_layout_child_set_transform (child_info, transform);
   gsk_transform_unref (transform);
 }
 
@@ -196,7 +196,7 @@ gtk_fixed_get_child_position (GtkFixed  *fixed,
   g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
 
   child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
-  transform = gtk_fixed_layout_child_get_position (child_info);
+  transform = gtk_fixed_layout_child_get_transform (child_info);
   gsk_transform_to_translate (transform, &pos_x, &pos_y);
 
   if (x != NULL)
@@ -214,7 +214,7 @@ gtk_fixed_get_child_position (GtkFixed  *fixed,
  * Sets the transformation for @widget.
  *
  * This is a convenience function that retrieves the #GtkFixedLayoutChild
- * instance associated to @widget and calls gtk_fixed_layout_child_set_position().
+ * instance associated to @widget and calls gtk_fixed_layout_child_set_transform().
  */
 void
 gtk_fixed_set_child_transform (GtkFixed     *fixed,
@@ -229,7 +229,7 @@ gtk_fixed_set_child_transform (GtkFixed     *fixed,
   g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
 
   child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
-  gtk_fixed_layout_child_set_position (child_info, transform);
+  gtk_fixed_layout_child_set_transform (child_info, transform);
 }
 
 /**
@@ -254,7 +254,7 @@ gtk_fixed_get_child_transform (GtkFixed  *fixed,
   g_return_val_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed), NULL);
 
   child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
-  return gtk_fixed_layout_child_get_position (child_info);
+  return gtk_fixed_layout_child_get_transform (child_info);
 }
 
 /**
@@ -284,7 +284,7 @@ gtk_fixed_move (GtkFixed  *fixed,
   child_info = GTK_FIXED_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout,  widget));
 
   transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (x, y));
-  gtk_fixed_layout_child_set_position (child_info, transform);
+  gtk_fixed_layout_child_set_transform (child_info, transform);
   gsk_transform_unref (transform);
 }
 
diff --git a/gtk/gtkfixedlayout.c b/gtk/gtkfixedlayout.c
index f904c22c3f..86de960f42 100644
--- a/gtk/gtkfixedlayout.c
+++ b/gtk/gtkfixedlayout.c
@@ -77,12 +77,12 @@ struct _GtkFixedLayoutChild
 {
   GtkLayoutChild parent_instance;
 
-  GskTransform *position;
+  GskTransform *transform;
 };
 
 enum
 {
-  PROP_CHILD_POSITION = 1,
+  PROP_CHILD_TRANSFORM = 1,
 
   N_CHILD_PROPERTIES
 };
@@ -101,8 +101,8 @@ gtk_fixed_layout_child_set_property (GObject      *gobject,
 
   switch (prop_id)
     {
-    case PROP_CHILD_POSITION:
-      gtk_fixed_layout_child_set_position (self, g_value_get_boxed (value));
+    case PROP_CHILD_TRANSFORM:
+      gtk_fixed_layout_child_set_transform (self, g_value_get_boxed (value));
       break;
 
     default:
@@ -121,8 +121,8 @@ gtk_fixed_layout_child_get_property (GObject    *gobject,
 
   switch (prop_id)
     {
-    case PROP_CHILD_POSITION:
-      g_value_set_boxed (value, &self->position);
+    case PROP_CHILD_TRANSFORM:
+      g_value_set_boxed (value, &self->transform);
       break;
 
     default:
@@ -136,7 +136,7 @@ gtk_fixed_layout_child_finalize (GObject *gobject)
 {
   GtkFixedLayoutChild *self = GTK_FIXED_LAYOUT_CHILD (gobject);
 
-  gsk_transform_unref (self->position);
+  gsk_transform_unref (self->transform);
 
   G_OBJECT_CLASS (gtk_fixed_layout_child_parent_class)->finalize (gobject);
 }
@@ -150,10 +150,10 @@ gtk_fixed_layout_child_class_init (GtkFixedLayoutChildClass *klass)
   gobject_class->get_property = gtk_fixed_layout_child_get_property;
   gobject_class->finalize = gtk_fixed_layout_child_finalize;
 
-  child_props[PROP_CHILD_POSITION] =
-    g_param_spec_boxed ("position",
-                        P_("Position"),
-                        P_("The position of a child of a fixed layout"),
+  child_props[PROP_CHILD_TRANSFORM] =
+    g_param_spec_boxed ("transform",
+                        P_("transform"),
+                        P_("The transform of a child of a fixed layout"),
                         GSK_TYPE_TRANSFORM,
                         G_PARAM_READWRITE |
                         G_PARAM_STATIC_STRINGS |
@@ -168,30 +168,30 @@ gtk_fixed_layout_child_init (GtkFixedLayoutChild *self)
 }
 
 /**
- * gtk_fixed_layout_child_set_position:
+ * gtk_fixed_layout_child_set_transform:
  * @child: a #GtkFixedLayoutChild
- * @position: a #GskTransform
+ * @transform: a #GskTransform
  *
  * Sets the transformation of the child of a #GtkFixedLayout.
  */
 void
-gtk_fixed_layout_child_set_position (GtkFixedLayoutChild *child,
-                                     GskTransform        *position)
+gtk_fixed_layout_child_set_transform (GtkFixedLayoutChild *child,
+                                      GskTransform        *transform)
 {
   GtkLayoutManager *layout;
 
   g_return_if_fail (GTK_IS_FIXED_LAYOUT_CHILD (child));
 
-  child->position = gsk_transform_transform (child->position, position);
+  child->transform = gsk_transform_transform (child->transform, transform);
 
   layout = gtk_layout_child_get_layout_manager (GTK_LAYOUT_CHILD (child));
   gtk_layout_manager_layout_changed (layout);
 
-  g_object_notify_by_pspec (G_OBJECT (child), child_props[PROP_CHILD_POSITION]);
+  g_object_notify_by_pspec (G_OBJECT (child), child_props[PROP_CHILD_TRANSFORM]);
 }
 
 /**
- * gtk_fixed_layout_child_get_position:
+ * gtk_fixed_layout_child_get_transform:
  * @child: a #GtkFixedLayoutChild
  *
  * Retrieves the transformation of the child of a #GtkFixedLayout.
@@ -199,11 +199,11 @@ gtk_fixed_layout_child_set_position (GtkFixedLayoutChild *child,
  * Returns: (transfer none) (nullable): a #GskTransform
  */
 GskTransform *
-gtk_fixed_layout_child_get_position (GtkFixedLayoutChild *child)
+gtk_fixed_layout_child_get_transform (GtkFixedLayoutChild *child)
 {
   g_return_val_if_fail (GTK_IS_FIXED_LAYOUT_CHILD (child), NULL);
 
-  return child->position;
+  return child->transform;
 }
 
 G_DEFINE_TYPE (GtkFixedLayout, gtk_fixed_layout, GTK_TYPE_LAYOUT_MANAGER)
@@ -250,10 +250,10 @@ gtk_fixed_layout_measure (GtkLayoutManager *layout_manager,
                           &child_min_opp, &child_nat_opp,
                           NULL, NULL);
 
-      gsk_transform_transform_bounds (child_info->position,
+      gsk_transform_transform_bounds (child_info->transform,
                                       &GRAPHENE_RECT_INIT (0.f, 0.f, child_min, child_min_opp),
                                       &min_rect);
-      gsk_transform_transform_bounds (child_info->position,
+      gsk_transform_transform_bounds (child_info->transform,
                                       &GRAPHENE_RECT_INIT (0.f, 0.f, child_nat, child_nat_opp),
                                       &nat_rect);
 
@@ -301,7 +301,7 @@ gtk_fixed_layout_allocate (GtkLayoutManager *layout_manager,
                            child_req.width,
                            child_req.height,
                            -1,
-                           gsk_transform_ref (child_info->position));
+                           gsk_transform_ref (child_info->transform));
     }
 }
 
diff --git a/gtk/gtkfixedlayout.h b/gtk/gtkfixedlayout.h
index 090aceb138..8381d94c92 100644
--- a/gtk/gtkfixedlayout.h
+++ b/gtk/gtkfixedlayout.h
@@ -41,9 +41,9 @@ GDK_AVAILABLE_IN_ALL
 G_DECLARE_FINAL_TYPE (GtkFixedLayoutChild, gtk_fixed_layout_child, GTK, FIXED_LAYOUT_CHILD, GtkLayoutChild)
 
 GDK_AVAILABLE_IN_ALL
-void            gtk_fixed_layout_child_set_position     (GtkFixedLayoutChild *child,
-                                                         GskTransform        *position);
+void            gtk_fixed_layout_child_set_transform    (GtkFixedLayoutChild *child,
+                                                         GskTransform        *transform);
 GDK_AVAILABLE_IN_ALL
-GskTransform *  gtk_fixed_layout_child_get_position     (GtkFixedLayoutChild *child);
+GskTransform *  gtk_fixed_layout_child_get_transform    (GtkFixedLayoutChild *child);
 
 G_END_DECLS


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