summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-05-11 15:34:44 -0400
committerMatthias Clasen <mclasen@redhat.com>2023-05-11 15:34:44 -0400
commit4ea2aac5612a58182711eda7a5dc8b5175d567a1 (patch)
tree827f26fe71f31f67b75068b8e1d28b0b52f1ed01
parente88e31dde2f51d6d5af9933e04952b9fa35eb718 (diff)
downloadgtk+-4ea2aac5612a58182711eda7a5dc8b5175d567a1.tar.gz
spinbutton: Update baseline child
When the orientation changes, the entry changes position, so we need to update baseline-child to match.
-rw-r--r--gtk/gtkspinbutton.c6
1 files 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");