From 4ea2aac5612a58182711eda7a5dc8b5175d567a1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 11 May 2023 15:34:44 -0400 Subject: [PATCH] spinbutton: Update baseline child When the orientation changes, the entry changes position, so we need to update baseline-child to match. --- gtk/gtkspinbutton.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 447af1d640..f7ef127cc5 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -996,7 +996,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button) { GtkEventController *controller; GtkGesture *gesture; - GtkLayoutManager *layout; spin_button->adjustment = NULL; spin_button->timer = 0; @@ -1012,9 +1011,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button) spin_button->snap_to_ticks = FALSE; spin_button->width_chars = -1; - layout = gtk_widget_get_layout_manager (GTK_WIDGET (spin_button)); - gtk_box_layout_set_baseline_child (GTK_BOX_LAYOUT (layout), 1); - gtk_widget_update_orientation (GTK_WIDGET (spin_button), GTK_ORIENTATION_HORIZONTAL); spin_button->entry = gtk_text_new (); @@ -1217,11 +1213,13 @@ gtk_spin_button_set_orientation (GtkSpinButton *spin, { /* Current orientation of the box is vertical! */ gtk_widget_insert_after (spin->up_button, GTK_WIDGET (spin), spin->down_button); + gtk_box_layout_set_baseline_child (layout_manager, 0); } else { /* Current orientation of the box is horizontal! */ gtk_widget_insert_before (spin->up_button, GTK_WIDGET (spin), spin->entry); + gtk_box_layout_set_baseline_child (layout_manager, 1); } g_object_notify (G_OBJECT (spin), "orientation"); -- 2.30.2