Disable pango attributes on sexy entry while it contains preedit text.

Fixes #1360
This commit is contained in:
Arnavion 2015-04-24 19:20:48 -07:00
parent 9b2c560519
commit 0b40146b85
1 changed files with 15 additions and 1 deletions

View File

@ -141,6 +141,8 @@ enum
}; };
static guint signals[LAST_SIGNAL] = {0}; static guint signals[LAST_SIGNAL] = {0};
static PangoAttrList *empty_attrs_list = NULL;
static gboolean static gboolean
spell_accumulator(GSignalInvocationHint *hint, GValue *return_accu, const GValue *handler_return, gpointer data) 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, _hexchat_marshal_BOOLEAN__STRING,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
1, G_TYPE_STRING); 1, G_TYPE_STRING);
if (empty_attrs_list == NULL)
{
empty_attrs_list = pango_attr_list_new ();
}
} }
static void static void
@ -1080,7 +1087,14 @@ sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event)
layout = gtk_entry_get_layout(gtk_entry); layout = gtk_entry_get_layout(gtk_entry);
if (gtk_entry->preedit_length == 0)
{
pango_layout_set_attributes(layout, entry->priv->attr_list); 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); return GTK_WIDGET_CLASS(parent_class)->expose_event (widget, event);
} }