From: Timm Bäder Date: Sun, 25 Aug 2019 12:56:13 +0000 (+0200) Subject: fixedlayout: Don't call the child transform position X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~931 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1db59d1c89580970552e63e84ff43a3e0553d1eb;p=gtk4.git fixedlayout: Don't call the child transform position It's a full transform and not just a translation these days. --- 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/background-position.ref.ui b/testsuite/reftests/background-position.ref.ui index 10d9ec9662..d7d6a5c6b7 100644 --- a/testsuite/reftests/background-position.ref.ui +++ b/testsuite/reftests/background-position.ref.ui @@ -15,7 +15,7 @@ 1 ref - translate(10, 10) + translate(10, 10) @@ -27,7 +27,7 @@ 1 ref - translate(40, 10) + translate(40, 10) @@ -39,7 +39,7 @@ 1 ref - translate(80, 20) + translate(80, 20) @@ -51,7 +51,7 @@ 1 ref - translate(20, 60) + translate(20, 60) @@ -63,7 +63,7 @@ 1 ref - translate(60, 40) + translate(60, 40) @@ -75,7 +75,7 @@ 1 ref - translate(100, 50) + translate(100, 50) @@ -87,7 +87,7 @@ 1 ref - translate(10, 90) + translate(10, 90) @@ -99,7 +99,7 @@ 1 ref - translate(40, 90) + translate(40, 90) @@ -111,7 +111,7 @@ 1 ref - translate(100, 100) + translate(100, 100) 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 @@ - translate(5, 5) + translate(5, 5) @@ -75,7 +75,7 @@ - translate(20, 20) + translate(20, 20) @@ -119,7 +119,7 @@ - translate(5, 5) + translate(5, 5) @@ -132,7 +132,7 @@ - translate(20, 20) + translate(20, 20) @@ -165,7 +165,7 @@ - translate(5, 5) + translate(5, 5) @@ -179,7 +179,7 @@ - translate(30, 30) + translate(30, 30) @@ -223,7 +223,7 @@ - translate(5, 5) + translate(5, 5) @@ -236,7 +236,7 @@ - translate(30, 30) + translate(30, 30) 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 1 textbuffer1 - translate(50, 50) + translate(50, 50) 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 - translate(50, 50) + translate(50, 50) diff --git a/testsuite/reftests/label-shadows.ref.ui b/testsuite/reftests/label-shadows.ref.ui index 4761ff9ec2..32c9c96922 100644 --- a/testsuite/reftests/label-shadows.ref.ui +++ b/testsuite/reftests/label-shadows.ref.ui @@ -12,7 +12,7 @@ 100 ABC - translate(50, 50) rotate(0) translate(-49,-49) + translate(50, 50) rotate(0) translate(-49,-49) @@ -28,7 +28,7 @@ 100 ABC - translate(50, 50) rotate(0) translate(-50,-50) + translate(50, 50) rotate(0) translate(-50,-50)