summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2017-04-11 00:27:40 +0200
committerDaniel Carl <danielcarl@gmx.de>2017-04-11 00:27:40 +0200
commit6952dcb0fd6558893b2b7cb9f5a12bd8f74b1591 (patch)
tree17e3e89959d7a0e11fc451053e0d40ebc991f2bd
parent382e219f05bbfb5e44c4e57a74eb299daddcda4d (diff)
parentb83c174be0430868b477202c237bb572c4333045 (diff)
Merge branch 'fix_ensure_input_text_view_size' of https://github.com/rti/vimb into webkit2
-rw-r--r--src/main.c26
1 files changed, 26 insertions, 0 deletions
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);
}