From 0b40146b85e9017fdfe6d98bf33f622defa186db Mon Sep 17 00:00:00 2001 From: Arnavion Date: Fri, 24 Apr 2015 19:20:48 -0700 Subject: Disable pango attributes on sexy entry while it contains preedit text. Fixes #1360 --- src/fe-gtk/sexy-spell-entry.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 0617d947..61cdff3e 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -141,6 +141,8 @@ enum }; static guint signals[LAST_SIGNAL] = {0}; +static PangoAttrList *empty_attrs_list = NULL; + static gboolean spell_accumulator(GSignalInvocationHint *hint, GValue *return_accu, const GValue *handler_return, gpointer data) { @@ -248,6 +250,11 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass) _hexchat_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); + + if (empty_attrs_list == NULL) + { + empty_attrs_list = pango_attr_list_new (); + } } static void @@ -1080,7 +1087,14 @@ sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event) layout = gtk_entry_get_layout(gtk_entry); - pango_layout_set_attributes(layout, entry->priv->attr_list); + if (gtk_entry->preedit_length == 0) + { + pango_layout_set_attributes(layout, entry->priv->attr_list); + } + else + { + pango_layout_set_attributes(layout, empty_attrs_list); + } return GTK_WIDGET_CLASS(parent_class)->expose_event (widget, event); } -- cgit 1.4.1