From b201d66981e2ac4823ebcf0e13d72215160809cd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 28 Apr 2023 15:25:09 -0400 Subject: [PATCH] Stop using gtk_widget_get_allocated_baseline Use gtk_widget_get_baseline instead. --- gtk/gtkgridlayout.c | 4 ++-- gtk/gtkimage.c | 2 +- gtk/gtkinscription.c | 2 +- gtk/gtklabel.c | 2 +- gtk/inspector/baselineoverlay.c | 2 +- gtk/inspector/misc-info.c | 2 +- tests/testbaseline2.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk/gtkgridlayout.c b/gtk/gtkgridlayout.c index 1659eb1cb7..1e2a8b7bcc 100644 --- a/gtk/gtkgridlayout.c +++ b/gtk/gtkgridlayout.c @@ -1162,7 +1162,7 @@ grid_request_allocate (GridRequest *request, lines = &request->lines[orientation]; spacing = get_spacing (request->layout, request->widget, orientation); - baseline = gtk_widget_get_allocated_baseline (request->widget); + baseline = gtk_widget_get_baseline (request->widget); if (orientation == GTK_ORIENTATION_VERTICAL && baseline != -1 && self->baseline_row >= lines->min && self->baseline_row < lines->max && @@ -1298,7 +1298,7 @@ grid_request_position (GridRequest *request, lines = &request->lines[orientation]; spacing = get_spacing (request->layout, request->widget, orientation); - allocated_baseline = gtk_widget_get_allocated_baseline (request->widget); + allocated_baseline = gtk_widget_get_baseline (request->widget); position = 0; for (i = 0; i < lines->max - lines->min; i++) diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 7cc98f17d9..44690975a2 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -1014,7 +1014,7 @@ gtk_image_snapshot (GtkWidget *widget, x = (width - ceil (w)) / 2; - baseline = gtk_widget_get_allocated_baseline (widget); + baseline = gtk_widget_get_baseline (widget); if (baseline == -1) y = floor(height - ceil (h)) / 2; else diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c index b5ecabac74..1689f1044c 100644 --- a/gtk/gtkinscription.c +++ b/gtk/gtkinscription.c @@ -432,7 +432,7 @@ gtk_inscription_get_layout_location (GtkInscription *self, else x = floor ((xalign * (widget_width - logical.width)) - logical.x); - baseline = gtk_widget_get_allocated_baseline (widget); + baseline = gtk_widget_get_baseline (widget); if (baseline != -1) { int layout_baseline = pango_layout_get_baseline (self->layout) / PANGO_SCALE; diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 75878a5d3d..ecb48a8d07 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1335,7 +1335,7 @@ get_layout_location (GtkLabel *self, pango_layout_get_pixel_extents (self->layout, NULL, &logical); x = floor ((xalign * (widget_width - logical.width)) - logical.x); - baseline = gtk_widget_get_allocated_baseline (widget); + baseline = gtk_widget_get_baseline (widget); if (baseline != -1) { int layout_baseline = pango_layout_get_baseline (self->layout) / PANGO_SCALE; diff --git a/gtk/inspector/baselineoverlay.c b/gtk/inspector/baselineoverlay.c index 276a4cc82e..4d406b11c9 100644 --- a/gtk/inspector/baselineoverlay.c +++ b/gtk/inspector/baselineoverlay.c @@ -36,7 +36,7 @@ recurse_child_widgets (GtkWidget *widget, gtk_snapshot_push_rounded_clip (snapshot, gtk_css_boxes_get_padding_box (&boxes)); } - baseline = gtk_widget_get_allocated_baseline (widget); + baseline = gtk_widget_get_baseline (widget); if (baseline != -1) { diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 0886507e48..31327d34de 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -160,7 +160,7 @@ update_allocation (GtkWidget *w, gtk_label_set_label (GTK_LABEL (sl->bounds), size_label); g_free (size_label); - size_label = g_strdup_printf ("%d", gtk_widget_get_allocated_baseline (w)); + size_label = g_strdup_printf ("%d", gtk_widget_get_baseline (w)); gtk_label_set_label (GTK_LABEL (sl->baseline), size_label); g_free (size_label); diff --git a/tests/testbaseline2.c b/tests/testbaseline2.c index 1e065cbe34..4ea799d50c 100644 --- a/tests/testbaseline2.c +++ b/tests/testbaseline2.c @@ -131,7 +131,7 @@ baseline_widget_snapshot (GtkWidget *widget, GskRoundedRect outline; height = gtk_widget_get_height (widget); - baseline = gtk_widget_get_allocated_baseline (widget); + baseline = gtk_widget_get_baseline (widget); gtk_snapshot_save (snapshot);