[libadwaita/wip/exalm/message-dialog: 4/5] message-dialog: Use max width instead of min width when there's no parent




commit eff59410621125aa8022bcfe7afdfcd5046e1d84
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Aug 31 18:02:28 2022 +0400

    message-dialog: Use max width instead of min width when there's no parent
    
    While we mever recommend that, we do use it for doc screenshots.

 src/adw-message-dialog.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-message-dialog.c b/src/adw-message-dialog.c
index f6c3ea09..b3358fdf 100644
--- a/src/adw-message-dialog.c
+++ b/src/adw-message-dialog.c
@@ -510,8 +510,12 @@ adw_message_dialog_measure (GtkWidget      *widget,
 
     min_size = MAX (min_size, DIALOG_MIN_WIDTH);
 
-    max_size = priv->parent_width - DIALOG_MARGIN * 2;
-    max_size = MIN (max_size, DIALOG_MAX_WIDTH);
+    if (priv->parent_window) {
+      max_size = priv->parent_width - DIALOG_MARGIN * 2;
+      max_size = MIN (max_size, DIALOG_MAX_WIDTH);
+    } else {
+      max_size = DIALOG_MAX_WIDTH;
+    }
 
     gtk_widget_measure (GTK_WIDGET (priv->wide_response_box),
                         GTK_ORIENTATION_HORIZONTAL, -1,


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