fixedlayout: Don't call the child transform position
authorTimm Bäder <mail@baedert.org>
Sun, 25 Aug 2019 12:56:13 +0000 (14:56 +0200)
committerTimm Bäder <mail@baedert.org>
Mon, 9 Sep 2019 15:36:25 +0000 (17:36 +0200)
It's a full transform and not just a translation these days.

gtk/gtkfixed.c
gtk/gtkfixedlayout.c
gtk/gtkfixedlayout.h
testsuite/reftests/background-position.ref.ui
testsuite/reftests/box-shadow-spec-inset.ref.ui
testsuite/reftests/fixed-widget-stacking.ref.ui
testsuite/reftests/fixed-widget-stacking.ui
testsuite/reftests/label-shadows.ref.ui
testsuite/reftests/label-shadows.ui

index 2251c0bce1154eb2a5167af6bee6068af0a87be7..dc6d34249cf37f58393fe3253cb6a4a7e4f06f2b 100644 (file)
@@ -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);
 }
 
index f904c22c3fdcb65c1dae18bd3c1f14b4b0fc0dec..86de960f42a719d56104b795a77f4e22c842ab4d 100644 (file)
@@ -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));
     }
 }
 
index 090aceb13823cf3cb1e7c5a395e986c41a4a35ae..8381d94c926c7ffd480eb430f716fdff86b2b4ae 100644 (file)
@@ -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
index 10d9ec9662050880b2719ac7d4ea524186881a70..d7d6a5c6b704af7ee6a65f7e707dd48d35c2ebb1 100644 (file)
@@ -15,7 +15,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(10, 10)</property>
+              <property name="transform">translate(10, 10)</property>
             </layout>
           </object>
         </child>
@@ -27,7 +27,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(40, 10)</property>
+              <property name="transform">translate(40, 10)</property>
             </layout>
           </object>
         </child>
@@ -39,7 +39,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(80, 20)</property>
+              <property name="transform">translate(80, 20)</property>
             </layout>
           </object>
         </child>
@@ -51,7 +51,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(20, 60)</property>
+              <property name="transform">translate(20, 60)</property>
             </layout>
           </object>
         </child>
@@ -63,7 +63,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(60, 40)</property>
+              <property name="transform">translate(60, 40)</property>
             </layout>
           </object>
         </child>
@@ -75,7 +75,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(100, 50)</property>
+              <property name="transform">translate(100, 50)</property>
             </layout>
           </object>
         </child>
@@ -87,7 +87,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(10, 90)</property>
+              <property name="transform">translate(10, 90)</property>
             </layout>
           </object>
         </child>
@@ -99,7 +99,7 @@
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(40, 90)</property>
+              <property name="transform">translate(40, 90)</property>
             </layout>
           </object>
         </child>
             <property name="receives_default">1</property>
             <property name="name">ref</property>
             <layout>
-              <property name="position">translate(100, 100)</property>
+              <property name="transform">translate(100, 100)</property>
             </layout>
           </object>
         </child>
index 1246a1c6cea2e7448d1527d462aeb6ca763b777b..14646a3a4a7aa3a14947472d751d17e7209a46df 100644 (file)
@@ -61,7 +61,7 @@
                   <class name="reference-padding-radius"/>
                 </style>
                 <layout>
-                  <property name="position">translate(5, 5)</property>
+                  <property name="transform">translate(5, 5)</property>
                 </layout>
               </object>
             </child>
@@ -75,7 +75,7 @@
                   <class name="column1"/>
                 </style>
                 <layout>
-                  <property name="position">translate(20, 20)</property>
+                  <property name="transform">translate(20, 20)</property>
                 </layout>
               </object>
             </child>
                   <class name="column2"/>
                 </style>
                 <layout>
-                  <property name="position">translate(5, 5)</property>
+                  <property name="transform">translate(5, 5)</property>
                 </layout>
               </object>
             </child>
                   <class name="column2"/>
                 </style>
                 <layout>
-                  <property name="position">translate(20, 20)</property>
+                  <property name="transform">translate(20, 20)</property>
                 </layout>
               </object>
             </child>
                   <class name="reference-padding-radius"/>
                 </style>
                 <layout>
-                  <property name="position">translate(5, 5)</property>
+                  <property name="transform">translate(5, 5)</property>
                 </layout>
               </object>
             </child>
                   <class name="column1"/>
                 </style>
                 <layout>
-                  <property name="position">translate(30, 30)</property>
+                  <property name="transform">translate(30, 30)</property>
                 </layout>
               </object>
             </child>
                   <class name="column2"/>
                 </style>
                 <layout>
-                  <property name="position">translate(5, 5)</property>
+                  <property name="transform">translate(5, 5)</property>
                 </layout>
               </object>
             </child>
                   <class name="column2"/>
                 </style>
                 <layout>
-                  <property name="position">translate(30, 30)</property>
+                  <property name="transform">translate(30, 30)</property>
                 </layout>
               </object>
             </child>
index 65ae50f8e93a90926e8b441303626e8454bd4ee0..acfe9c984c7666bb51cf2ba13b940f5bcc784b57 100644 (file)
@@ -22,7 +22,7 @@ TEST123</property>
             <property name="can_focus">1</property>
             <property name="buffer">textbuffer1</property>
             <layout>
-              <property name="position">translate(50, 50)</property>
+              <property name="transform">translate(50, 50)</property>
             </layout>
           </object>
         </child>
index 5be91e13cc274b077644e54049d25441b5364d4c..dc2e9f73a72ae66235d4cb28f4270177b7315332 100644 (file)
@@ -27,7 +27,7 @@ TEST123</property>
               </object>
             </child>
             <layout>
-              <property name="position">translate(50, 50)</property>
+              <property name="transform">translate(50, 50)</property>
             </layout>
           </object>
         </child>
index 4761ff9ec258b64a161283b0c1c3d1f559f094a3..32c9c9692214afd0d4e4942d981fa90eb9d3c2cf 100644 (file)
@@ -12,7 +12,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 50) rotate(0) translate(-49,-49)</property>
+              <property name="transform">translate(50, 50) rotate(0) translate(-49,-49)</property>
             </layout>
             <attributes>
               <attribute name="foreground" value="#ffff00000000"></attribute>
@@ -28,7 +28,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 50) rotate(0) translate(-50,-50)</property>
+              <property name="transform">translate(50, 50) rotate(0) translate(-50,-50)</property>
             </layout>
             <style>
               <class name="no-shadow"/>
@@ -41,7 +41,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 50) rotate(90) translate(-49,-49)</property>
+              <property name="transform">translate(150, 50) rotate(90) translate(-49,-49)</property>
             </layout>
             <attributes>
               <attribute name="foreground" value="#ffff00000000"></attribute>
@@ -57,7 +57,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 50) rotate(90) translate(-50,-50)</property>
+              <property name="transform">translate(150, 50) rotate(90) translate(-50,-50)</property>
             </layout>
             <style>
               <class name="no-shadow"/>
@@ -70,7 +70,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 150) rotate(180) translate(-49,-49)</property>
+              <property name="transform">translate(150, 150) rotate(180) translate(-49,-49)</property>
             </layout>
             <attributes>
               <attribute name="foreground" value="#ffff00000000"></attribute>
@@ -86,7 +86,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 150) rotate(180) translate(-50,-50)</property>
+              <property name="transform">translate(150, 150) rotate(180) translate(-50,-50)</property>
             </layout>
             <style>
               <class name="no-shadow"/>
@@ -99,7 +99,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 150) rotate(180) translate(-49,-49)</property>
+              <property name="transform">translate(50, 150) rotate(180) translate(-49,-49)</property>
             </layout>
             <attributes>
               <attribute name="foreground" value="#ffff00000000"></attribute>
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 150) rotate(180) translate(-50,-50)</property>
+              <property name="transform">translate(50, 150) rotate(180) translate(-50,-50)</property>
             </layout>
             <style>
               <class name="no-shadow"/>
index bba30cda1d46c7e871ed5dc72e7ed9a82edff74d..56a6ac0a2d4192637911e3752d3e254dbd01196b 100644 (file)
@@ -12,7 +12,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 50) rotate(0) translate(-50,-50)</property>
+              <property name="transform">translate(50, 50) rotate(0) translate(-50,-50)</property>
             </layout>
           </object>
         </child>
@@ -22,7 +22,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 50) rotate(90) translate(-50,-50)</property>
+              <property name="transform">translate(150, 50) rotate(90) translate(-50,-50)</property>
             </layout>
           </object>
         </child>
@@ -32,7 +32,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(150, 150) rotate(180) translate(-50,-50)</property>
+              <property name="transform">translate(150, 150) rotate(180) translate(-50,-50)</property>
             </layout>
           </object>
         </child>
@@ -42,7 +42,7 @@
             <property name="height-request">100</property>
             <property name="label" translatable="yes">ABC</property>
             <layout>
-              <property name="position">translate(50, 150) rotate(180) translate(-50,-50)</property>
+              <property name="transform">translate(50, 150) rotate(180) translate(-50,-50)</property>
             </layout>
           </object>
         </child>