summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextsimple.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-09-07 17:02:47 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-09-07 17:02:47 +0000
commit78ea5d7ed2253268fc6b540c7f402a4ec844b9f1 (patch)
treec98eede606c379384cd09710a3a142f3b98ffd46 /gtk/gtkimcontextsimple.c
parent2726ffafe39804fd730632ee1fb7c76360abe933 (diff)
downloadgtk+-78ea5d7ed2253268fc6b540c7f402a4ec844b9f1.tar.gz
Make C-u commit and restart hex input if we are already in a hex sequence.
2005-09-07 Matthias Clasen <mclasen@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): Make C-u commit and restart hex input if we are already in a hex sequence.
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r--gtk/gtkimcontextsimple.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 8c6719e224..ac98ac0656 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -1381,7 +1381,8 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
if (!have_hex_mods ||
(n_compose > 0 && !context_simple->in_hex_sequence) ||
(n_compose == 0 && !context_simple->in_hex_sequence && !is_hex_start) ||
- (context_simple->in_hex_sequence && !hex_keyval && !is_space && !is_backspace))
+ (context_simple->in_hex_sequence && !hex_keyval &&
+ !is_hex_start && !is_space && !is_backspace))
{
if (event->state & (gtk_accelerator_get_default_mod_mask () & ~GDK_SHIFT_MASK))
return FALSE;
@@ -1406,8 +1407,28 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
return TRUE;
}
+ if (context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
+ {
+ if (context_simple->tentative_match &&
+ g_unichar_validate (context_simple->tentative_match))
+ {
+ gtk_im_context_simple_commit_char (context, context_simple->tentative_match);
+ context_simple->compose_buffer[0] = 0;
+ }
+ else
+ {
+ /* invalid hex sequence */
+ if (n_compose > 0)
+ gdk_display_beep (gdk_drawable_get_display (event->window));
+
+ context_simple->tentative_match = 0;
+ context_simple->in_hex_sequence = FALSE;
+ context_simple->compose_buffer[0] = 0;
+ }
+ }
+
/* Check for hex sequence start */
- if (n_compose == 0 && !context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
+ if (!context_simple->in_hex_sequence && have_hex_mods && is_hex_start)
{
context_simple->compose_buffer[0] = 0;
context_simple->in_hex_sequence = TRUE;