From e7a420c40e1699587b13cd7f1eff66ed11fe8cce Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 22 May 2020 15:53:18 -0400 Subject: [PATCH 1/2] testsuite: Re-add the sizegroups-evolution reftest It doesn't seem to cause problems in ci anymore. --- testsuite/reftests/meson.build | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build index 9dcfc3925e..005f0d9ca9 100644 --- a/testsuite/reftests/meson.build +++ b/testsuite/reftests/meson.build @@ -387,9 +387,8 @@ testdata = [ 'sizegroups-basics.css', 'sizegroups-basics.ui', 'sizegroups-basics.ref.ui', - # this one triggers pango assertion in ci - #'sizegroups-evolution-identity-page.ui', - #'sizegroups-evolution-identity-page.ref.ui', + 'sizegroups-evolution-identity-page.ui', + 'sizegroups-evolution-identity-page.ref.ui', 'sizegroups-get-preferred-null.ui', 'sizegroups-get-preferred-null.ref.ui', 'statusbar-remove-all.ref.ui', @@ -433,8 +432,7 @@ testdata = [ # These need to be fixed but the issue hasn't been tracked down. xfails = [ - # see above - #'sizegroups-evolution-identity-page.ui', + 'sizegroups-evolution-identity-page.ui', # these depend on details of text layout 'label-sizing.ui', ] From 33b836af7fc153fe1162b9a2ed5af4d132899ccf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 22 May 2020 17:19:35 -0400 Subject: [PATCH 2/2] fixed: Change coordinate apis to doubles We are using floating point for coordinates everywhere now, so be consistent here. This commit also changes the implementation of gtk_fixed_get_child_position to work with non-translation child transforms. --- docs/reference/gtk/migrating-3to4.xml | 11 +++++++++++ gtk/gtkfixed.c | 24 +++++++----------------- gtk/gtkfixed.h | 12 ++++++------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml index e65d19befe..e9c8cbc829 100644 --- a/docs/reference/gtk/migrating-3to4.xml +++ b/docs/reference/gtk/migrating-3to4.xml @@ -695,6 +695,17 @@ +
+ Adapt to coordinate API changes + + A number of APIs that are accepting or returning coordinates have + been changed from ints to doubles: gtk_widget_translate_coordinates(), + gtk_fixed_put(), gtk_fixed_move(). This change is mostly transparent, + except for cases where out parameters are involved: you need to + pass double* now, instead of int*. + +
+
Adapt to GtkStyleContext API changes diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index ece7814a63..68973717e8 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -226,8 +226,8 @@ gtk_fixed_new (void) void gtk_fixed_put (GtkFixed *fixed, GtkWidget *widget, - gint x, - gint y) + double x, + double y) { GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed); GtkFixedLayoutChild *child_info; @@ -261,26 +261,16 @@ gtk_fixed_put (GtkFixed *fixed, void gtk_fixed_get_child_position (GtkFixed *fixed, GtkWidget *widget, - int *x, - int *y) + double *x, + double *y) { - GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed); - GtkFixedLayoutChild *child_info; - float pos_x = 0.f, pos_y = 0.f; - GskTransform *transform; - g_return_if_fail (GTK_IS_FIXED (fixed)); g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (x != NULL); g_return_if_fail (y != NULL); 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_transform (child_info); - gsk_transform_to_translate (transform, &pos_x, &pos_y); - - *x = floorf (pos_x); - *y = floorf (pos_y); + gtk_widget_translate_coordinates (widget, GTK_WIDGET (fixed), 0, 0, x, y); } /** @@ -350,8 +340,8 @@ gtk_fixed_get_child_transform (GtkFixed *fixed, void gtk_fixed_move (GtkFixed *fixed, GtkWidget *widget, - gint x, - gint y) + double x, + double y) { GtkFixedPrivate *priv = gtk_fixed_get_instance_private (fixed); GtkFixedLayoutChild *child_info; diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h index e16827dbb6..e1173fdf13 100644 --- a/gtk/gtkfixed.h +++ b/gtk/gtkfixed.h @@ -67,21 +67,21 @@ GtkWidget * gtk_fixed_new (void); GDK_AVAILABLE_IN_ALL void gtk_fixed_put (GtkFixed *fixed, GtkWidget *widget, - gint x, - gint y); + double x, + double y); GDK_AVAILABLE_IN_ALL void gtk_fixed_remove (GtkFixed *fixed, GtkWidget *widget); GDK_AVAILABLE_IN_ALL void gtk_fixed_move (GtkFixed *fixed, GtkWidget *widget, - gint x, - gint y); + double x, + double y); GDK_AVAILABLE_IN_ALL void gtk_fixed_get_child_position (GtkFixed *fixed, GtkWidget *widget, - gint *x, - gint *y); + double *x, + double *y); GDK_AVAILABLE_IN_ALL void gtk_fixed_set_child_transform (GtkFixed *fixed,