From d4a5872fb0768833d8578bd55e1d38e0b07178d8 Mon Sep 17 00:00:00 2001 From: Alice Mikhaylenko Date: Fri, 4 Aug 2023 04:30:55 +0400 Subject: [PATCH] centerlayout: Invert :shrink-center-last Make what it does match its name. --- gtk/gtkcenterbox.c | 6 +++--- gtk/gtkcenterlayout.c | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c index 1d9ab7caaf..5f7bd39a2d 100644 --- a/gtk/gtkcenterbox.c +++ b/gtk/gtkcenterbox.c @@ -309,14 +309,14 @@ gtk_center_box_class_init (GtkCenterBoxClass *klass) * natural widths, the start and end widgets start shrinking and the * center child keeps natural width until they reach minimum width. * - * If set to `TRUE`, start and end widgets keep natural width and the + * If set to `FALSE`, start and end widgets keep natural width and the * center widget starts shrinking instead. * * Since: 4.12 */ props[PROP_SHRINK_CENTER_LAST] = g_param_spec_boolean ("shrink-center-last", NULL, NULL, - FALSE, + TRUE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); g_object_class_install_properties (object_class, LAST_PROP, props); @@ -554,7 +554,7 @@ gtk_center_box_get_baseline_position (GtkCenterBox *self) * natural widths, the start and end widgets start shrinking and the * center child keeps natural width until they reach minimum width. * - * If set to `TRUE`, start and end widgets keep natural width and the + * If set to `FALSE`, start and end widgets keep natural width and the * center widget starts shrinking instead. * * Since: 4.12 diff --git a/gtk/gtkcenterlayout.c b/gtk/gtkcenterlayout.c index 24c9ea8635..2660a4d47c 100644 --- a/gtk/gtkcenterlayout.c +++ b/gtk/gtkcenterlayout.c @@ -150,9 +150,9 @@ gtk_center_layout_distribute (GtkCenterLayout *self, avail = size - needed_spacing - (sizes[0].minimum_size + sizes[2].minimum_size); if (self->shrink_center_last) - natural_size = CLAMP (size - needed_spacing - (sizes[0].natural_size + sizes[2].natural_size), sizes[1].minimum_size, sizes[1].natural_size); - else natural_size = sizes[1].natural_size; + else + natural_size = CLAMP (size - needed_spacing - (sizes[0].natural_size + sizes[2].natural_size), sizes[1].minimum_size, sizes[1].natural_size); center_size = CLAMP (avail, sizes[1].minimum_size, natural_size); center_expand = gtk_widget_compute_expand (self->center_widget, self->orientation); @@ -607,14 +607,14 @@ gtk_center_layout_class_init (GtkCenterLayoutClass *klass) * natural widths, the start and end widgets start shrinking and the * center child keeps natural width until they reach minimum width. * - * If set to `TRUE`, start and end widgets keep natural width and the + * If set to `FALSE`, start and end widgets keep natural width and the * center widget starts shrinking instead. * * Since: 4.12 */ props[PROP_SHRINK_CENTER_LAST] = g_param_spec_boolean ("shrink-center-last", NULL, NULL, - FALSE, + TRUE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); g_object_class_install_properties (object_class, LAST_PROP, props); @@ -625,6 +625,7 @@ gtk_center_layout_init (GtkCenterLayout *self) { self->orientation = GTK_ORIENTATION_HORIZONTAL; self->baseline_pos = GTK_BASELINE_POSITION_CENTER; + self->shrink_center_last = TRUE; } /** @@ -831,7 +832,7 @@ gtk_center_layout_get_end_widget (GtkCenterLayout *self) * natural widths, the start and end widgets start shrinking and the * center child keeps natural width until they reach minimum width. * - * If set to `TRUE`, start and end widgets keep natural width and the + * If set to `FALSE`, start and end widgets keep natural width and the * center widget starts shrinking instead. * * Since: 4.12 -- 2.30.2