diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-09-19 15:17:13 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-09-19 15:17:13 +0000 |
commit | 257e0f26efef81772816a722f730df0387a54263 (patch) | |
tree | 13f1c2b8a78e0d2d225fdb94ff965f8e04deaba6 /gtk/gtkentry.c | |
parent | f787ebb03f24399b9f862caf9116ce7c34cbd3df (diff) | |
download | gtk+-gtk-new-im.tar.gz |
Rip out support for multiple locales; that simple doesn't work reliablygtk-new-im
Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com>
* modules/input/{gtkimcontextxim.[ch],imxim.c}: Rip
out support for multiple locales; that simple doesn't
work reliably with current Xlib
* gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch]
gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c:
Add support for positioning the cursor within the preedit string.
* modules/input/gtkimcontextxim.[ch]:
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r-- | gtk/gtkentry.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index ab9782f96a..5ad764c49e 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1557,10 +1557,14 @@ gtk_entry_preedit_changed_cb (GtkIMContext *context, GtkEntry *entry) { gchar *preedit_string; + gint cursor_pos; gtk_im_context_get_preedit_string (entry->im_context, - &preedit_string, NULL); + &preedit_string, NULL, + &cursor_pos); entry->preedit_length = strlen (preedit_string); + cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1)); + cursor_pos = g_utf8_offset_to_pointer (preedit_string, cursor_pos) - preedit_string; g_free (preedit_string); gtk_entry_recompute (entry); @@ -1618,7 +1622,7 @@ gtk_entry_create_layout (GtkEntry *entry, if (include_preedit) { gtk_im_context_get_preedit_string (entry->im_context, - &preedit_string, &preedit_attrs); + &preedit_string, &preedit_attrs, NULL); preedit_length = entry->preedit_length; } @@ -1859,15 +1863,11 @@ gtk_entry_get_cursor_locations (GtkEntry *entry, gint *weak_x) { PangoLayout *layout = gtk_entry_get_layout (entry, TRUE); - gint cursor_index = g_utf8_offset_to_pointer (entry->text, entry->current_pos) - entry->text; + gint index = g_utf8_offset_to_pointer (entry->text, entry->current_pos) - entry->text; PangoRectangle strong_pos, weak_pos; - gint index; - - index = g_utf8_offset_to_pointer (entry->text, entry->current_pos) - entry->text; - if (index >= cursor_index) - index += entry->preedit_length; + index += entry->preedit_cursor; pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos); g_object_unref (G_OBJECT (layout)); |