mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
gtk/gtktextlayout.c (line_display_iter_to_index) Only adjust the preedit
Thu Jan 29 18:08:06 2004 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (line_display_iter_to_index) * gtk/gtktextlayout.c (line_display_index_to_iter): Only adjust the preedit position for lines that include the preedit string. (#132353, Yao Zhang). How the heck did this work as well as it did?!?! * modules/input/gtkimcontextxim.c (gtk_im_context_xim_get_ic): Reverse change to change of XNFilterEvents event mask from #110493 -- it's documented and in the Xlib code an unsigned long. * modules/input/gtkimcontextxim.c (preedit_start_callback): Return -1 rather than void to indicate no length limit. (#129548)
This commit is contained in:
parent
bdca6b33b8
commit
a5f9b185ab
@ -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),
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user