From fc9fbfe1e480082a5751f824846c10cf9bd6d6b6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 2 Apr 2021 12:54:52 +0100 Subject: [PATCH] gtk-askpass: add margins on left and right of the prompt. If the prompt got big enough to reach to the edges of the dialog box, it looked ugly without any margins. Previously I hadn't noticed, because the prompt text was never that big. --- unix/gtkask.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unix/gtkask.c b/unix/gtkask.c index 47222fbb..e6521e12 100644 --- a/unix/gtkask.c +++ b/unix/gtkask.c @@ -432,6 +432,13 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx, gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), true); #if GTK_CHECK_VERSION(3,0,0) gtk_label_set_width_chars(GTK_LABEL(ctx->promptlabel), 48); +#endif + int margin = string_width("MM"); +#if GTK_CHECK_VERSION(3,12,0) + gtk_widget_set_margin_start(ctx->promptlabel, margin); + gtk_widget_set_margin_end(ctx->promptlabel, margin); +#else + gtk_misc_set_padding(GTK_MISC(ctx->promptlabel), margin, 0); #endif our_dialog_add_to_content_area(GTK_WINDOW(ctx->dialog), ctx->promptlabel, true, true, 0);