[gtk/wip/baedert/for-master: 1/3] fixedlayout: Don't call the child transform position
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 1/3] fixedlayout: Don't call the child transform position
- Date: Sun, 25 Aug 2019 13:30:48 +0000 (UTC)
commit 2f83f850936bd9da5a02c3042568e99b887a4607
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 ++--
testsuite/reftests/box-shadow-spec-inset.ref.ui | 16 ++++-----
testsuite/reftests/fixed-widget-stacking.ref.ui | 2 +-
testsuite/reftests/fixed-widget-stacking.ui | 2 +-
testsuite/reftests/label-shadows.ui | 8 ++---
7 files changed, 46 insertions(+), 46 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
diff --git a/testsuite/reftests/box-shadow-spec-inset.ref.ui b/testsuite/reftests/box-shadow-spec-inset.ref.ui
index 1246a1c6ce..14646a3a4a 100644
--- a/testsuite/reftests/box-shadow-spec-inset.ref.ui
+++ b/testsuite/reftests/box-shadow-spec-inset.ref.ui
@@ -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>
@@ -119,7 +119,7 @@
<class name="column2"/>
</style>
<layout>
- <property name="position">translate(5, 5)</property>
+ <property name="transform">translate(5, 5)</property>
</layout>
</object>
</child>
@@ -132,7 +132,7 @@
<class name="column2"/>
</style>
<layout>
- <property name="position">translate(20, 20)</property>
+ <property name="transform">translate(20, 20)</property>
</layout>
</object>
</child>
@@ -165,7 +165,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>
@@ -179,7 +179,7 @@
<class name="column1"/>
</style>
<layout>
- <property name="position">translate(30, 30)</property>
+ <property name="transform">translate(30, 30)</property>
</layout>
</object>
</child>
@@ -223,7 +223,7 @@
<class name="column2"/>
</style>
<layout>
- <property name="position">translate(5, 5)</property>
+ <property name="transform">translate(5, 5)</property>
</layout>
</object>
</child>
@@ -236,7 +236,7 @@
<class name="column2"/>
</style>
<layout>
- <property name="position">translate(30, 30)</property>
+ <property name="transform">translate(30, 30)</property>
</layout>
</object>
</child>
diff --git a/testsuite/reftests/fixed-widget-stacking.ref.ui b/testsuite/reftests/fixed-widget-stacking.ref.ui
index 65ae50f8e9..acfe9c984c 100644
--- a/testsuite/reftests/fixed-widget-stacking.ref.ui
+++ b/testsuite/reftests/fixed-widget-stacking.ref.ui
@@ -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>
diff --git a/testsuite/reftests/fixed-widget-stacking.ui b/testsuite/reftests/fixed-widget-stacking.ui
index 5be91e13cc..dc2e9f73a7 100644
--- a/testsuite/reftests/fixed-widget-stacking.ui
+++ b/testsuite/reftests/fixed-widget-stacking.ui
@@ -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>
diff --git a/testsuite/reftests/label-shadows.ui b/testsuite/reftests/label-shadows.ui
index bba30cda1d..56a6ac0a2d 100644
--- a/testsuite/reftests/label-shadows.ui
+++ b/testsuite/reftests/label-shadows.ui
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]