[libadwaita/wip/exalm/message-dialog-2] message-dialog: Add minimum width for the wide mode too



commit 4ebd191748ae1660c16cba411d2cc482fdba9d0b
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jun 28 20:32:57 2022 +0400

    message-dialog: Add minimum width for the wide mode too

 src/adw-message-dialog.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/adw-message-dialog.c b/src/adw-message-dialog.c
index d91c7559..df3cb6dc 100644
--- a/src/adw-message-dialog.c
+++ b/src/adw-message-dialog.c
@@ -478,20 +478,22 @@ adw_message_dialog_measure (GtkWidget      *widget,
 {
   AdwMessageDialog *self = ADW_MESSAGE_DIALOG (widget);
   AdwMessageDialogPrivate *priv = adw_message_dialog_get_instance_private (self);
-  int max_size, base_min, base_nat;
+  int max_size, min_size, base_nat;
 
   GTK_WIDGET_CLASS (adw_message_dialog_parent_class)->measure (widget,
                                                                orientation,
                                                                for_size,
-                                                               &base_min,
+                                                               &min_size,
                                                                &base_nat,
                                                                NULL, NULL);
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL) {
     int wide_min, narrow_nat;
 
+    min_size = MAX (min_size, DIALOG_MIN_WIDTH);
+
     max_size = priv->parent_width - DIALOG_MARGIN * 2;
-    max_size = CLAMP (max_size, DIALOG_MIN_WIDTH, DIALOG_MAX_WIDTH);
+    max_size = MIN (max_size, DIALOG_MAX_WIDTH);
 
     gtk_widget_measure (GTK_WIDGET (priv->wide_response_box),
                         GTK_ORIENTATION_HORIZONTAL, -1,
@@ -508,12 +510,12 @@ adw_message_dialog_measure (GtkWidget      *widget,
     max_size = priv->parent_height - DIALOG_MARGIN * 2;
   }
 
-  max_size = MAX (base_min, max_size);
+  max_size = MAX (min_size, max_size);
 
   if (min)
-    *min = base_min;
+    *min = min_size;
   if (nat)
-    *nat = CLAMP (base_nat, base_min, max_size);
+    *nat = CLAMP (base_nat, min_size, max_size);
   if (min_baseline)
     *min_baseline = -1;
   if (nat_baseline)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]