From: Robert Timm Date: Sat, 8 Apr 2017 23:15:29 +0000 (+0200) Subject: ensures correct initial input GtkTextView size X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=b83c174be0430868b477202c237bb572c4333045;p=vimb.git ensures correct initial input GtkTextView size --- diff --git a/src/main.c b/src/main.c index 75023bb..ddadf8f 100644 --- a/src/main.c +++ b/src/main.c @@ -1477,6 +1477,32 @@ void vb_gui_style_update(Client *c, const char *setting_name_new, const char *se /* Feed style sheet document to gtk */ gtk_css_provider_load_from_data(vb.style_provider, style_sheet->str, -1, NULL); + /* WORKAROUND to always ensure correct size of input field + * + * The following line is required to apply the style defined font size on + * the GtkTextView c->input. Without the call, the font size is updated on + * first user input, leading to a sudden unpleasant widget size and layout + * change. According to the GTK+ docs, this call should not be required as + * style context invalidation is automatic. + * + * "gtk_style_context_invalidate has been deprecated since version 3.12 + * and should not be used in newly-written code. Style contexts are + * invalidated automatically." + * https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-invalidate + * + * Required settings in vimb config file: + * set input-autohide=true + * set input-font-normal=20pt monospace + * + * A bug has been filed at GTK+ + * https://bugzilla.gnome.org/show_bug.cgi?id=781158 + * + * Tested on ARCH linux with gtk3 3.22.10-1 + */ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + gtk_style_context_invalidate(gtk_widget_get_style_context(c->input)); + G_GNUC_END_IGNORE_DEPRECATIONS; + cleanup: g_string_free(style_sheet, TRUE); }