summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-01-29 23:33:07 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-01-29 23:33:07 +0000
commita5f9b185ab432db4c6e259bbf6284f8c4bdd0569 (patch)
treefc3420bd8d10f6c8a4874f4895056ce69ef38449
parentbdca6b33b8601efad6c3ba9ee767f91664479491 (diff)
downloadgtk+-a5f9b185ab432db4c6e259bbf6284f8c4bdd0569.tar.gz
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)
-rw-r--r--gtk/gtktextlayout.c20
-rw-r--r--modules/input/gtkimcontextxim.c6
2 files changed, 17 insertions, 9 deletions
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);