diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 3fed7624c4..157435a8b8 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -2026,8 +2026,11 @@ line_display_iter_to_index (GtkTextLayout *layout, index = gtk_text_iter_get_visible_line_index (iter); - if (index >= display->insert_index) - index += layout->preedit_len; + if (layout->preedit_len > 0 && display->insert_index >= 0) + { + if (index >= display->insert_index) + index += layout->preedit_len; + } return index; } @@ -2042,12 +2045,15 @@ line_display_index_to_iter (GtkTextLayout *layout, g_return_if_fail (!_gtk_text_line_is_last (display->line, _gtk_text_buffer_get_btree (layout->buffer))); - if (index >= display->insert_index + layout->preedit_len) - index -= layout->preedit_len; - else if (index > display->insert_index) + if (layout->preedit_len > 0 && display->insert_index >= 0) { - index = display->insert_index; - trailing = 0; + if (index >= display->insert_index + layout->preedit_len) + index -= layout->preedit_len; + else if (index > display->insert_index) + { + index = display->insert_index; + trailing = 0; + } } _gtk_text_btree_get_iter_at_line (_gtk_text_buffer_get_btree (layout->buffer), diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index d865fc2713..6b27aa3f0d 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -966,7 +966,7 @@ gtk_im_context_xim_get_preedit_string (GtkIMContext *context, *cursor_pos = context_xim->preedit_cursor; } -static void +static int preedit_start_callback (XIC xic, XPointer client_data, XPointer call_data) @@ -976,6 +976,8 @@ preedit_start_callback (XIC xic, if (!context_xim->finalizing) g_signal_emit_by_name (context, "preedit_start"); + + return -1; /* No length limit */ } static void @@ -1276,7 +1278,7 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim) * stroke if both key pressed and released events are filtered. * (bugzilla #81759) */ - guint32 mask = 0xaaaaaaaa; + gulong mask = 0xaaaaaaaa; XGetICValues (xic, XNFilterEvents, &mask, NULL);