diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-05-16 19:40:59 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-05-16 19:40:59 +0000 |
commit | e1816d8dd61d8268fd009944eca5da3c8682f1da (patch) | |
tree | b9e06e7211d5a1fc273ecc7c672db8d9dd2b014d /gtk/gtkimcontextsimple.c | |
parent | c7efe6f36c0c425cb4de5bf92a79dd14b0c9d52b (diff) | |
download | gtk+-e1816d8dd61d8268fd009944eca5da3c8682f1da.tar.gz |
Don't filter control-shift+[non-hex]. (#80252, reported by Nalin
Tue May 7 15:50:51 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
Don't filter control-shift+[non-hex].
(#80252, reported by Nalin Dahyabhai)
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r-- | gtk/gtkimcontextsimple.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index 4a2c99a6d9..ee15be780a 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -1103,10 +1103,9 @@ canonical_hex_keyval (GdkEventKey *event) if (keyval) return keyval; else - /* just return the keyval unchanged, we couldn't figure - * out a way to make it a hex digit + /* No way to make it a hex digit */ - return event->keyval; + return 0; } static gboolean @@ -1116,6 +1115,8 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context); GSList *tmp_list; int n_compose = 0; + gboolean have_hex_mods; + guint hex_keyval; int i; if (event->type == GDK_KEY_RELEASE) @@ -1144,30 +1145,31 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, if (event->keyval == gtk_compose_ignore[i]) return FALSE; + have_hex_mods = (event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK; + hex_keyval = canonical_hex_keyval (event); + while (context_simple->compose_buffer[n_compose] != 0) n_compose++; - /* First key in sequence; decide if it's a 14755 hex sequence */ - if (n_compose == 0) - context_simple->in_hex_sequence = - ((event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK); - /* If we are already in a non-hex sequence, or - * the 14755 modifiers are not held down, filter all + * this keystroke is not 14755 modifiers + hex digit, don't filter * key events with accelerator modifiers held down. */ - if (!context_simple->in_hex_sequence || - ((event->state & (ISO_14755_MOD_MASK)) != ISO_14755_MOD_MASK)) + if ((n_compose > 0 && !context_simple->in_hex_sequence) || !have_hex_mods || !hex_keyval) { if (event->state & (gtk_accelerator_get_default_mod_mask () & ~GDK_SHIFT_MASK)) return FALSE; } + /* First key in sequence; decide if it's a 14755 hex sequence */ + if (n_compose == 0) + context_simple->in_hex_sequence = have_hex_mods; + /* Then, check for compose sequences */ if (context_simple->in_hex_sequence) - context_simple->compose_buffer[n_compose++] = canonical_hex_keyval (event); + context_simple->compose_buffer[n_compose++] = hex_keyval ? hex_keyval : event->keyval; else context_simple->compose_buffer[n_compose++] = event->keyval; @@ -1176,7 +1178,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, if (context_simple->in_hex_sequence) { /* If the modifiers are still held down, consider the sequence again */ - if ((event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK) + if (have_hex_mods) { /* space ends the sequence, and we eat the space */ if (n_compose > 1 && @@ -1228,7 +1230,7 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context, PangoAttrList **attrs, gint *cursor_pos) { - char outbuf[25]; /* up to 4 hex digits */ + char outbuf[37]; /* up to 6 hex digits */ int len = 0; GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context); |