forked from AuroraMiddleware/gtk
fixedlayout: Don't call the child transform position
It's a full transform and not just a translation these days.
This commit is contained in:
parent
afb3715700
commit
1db59d1c89
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
@ -111,7 +111,7 @@
|
||||
<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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
@ -115,7 +115,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>
|
||||
<style>
|
||||
<class name="no-shadow"/>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user