diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index 9ef18a9b8b..d496166dff 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -871,7 +871,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, (context_simple->in_hex_sequence && !hex_keyval && !is_hex_start && !is_hex_end && !is_escape && !is_backspace)) { - if (event->state & (GDK_MOD1_MASK | GDK_CONTROL_MASK) || + if (event->state & GTK_NO_TEXT_INPUT_MOD_MASK || (context_simple->in_hex_sequence && context_simple->modifiers_dropped && (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter || diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index 61856679a0..34f34b6b9d 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -330,7 +330,7 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context, if (slave) return gtk_im_context_filter_keypress (slave, event); else if (event->type == GDK_KEY_PRESS && - (event->state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) == 0) + (event->state & GTK_NO_TEXT_INPUT_MOD_MASK) == 0) { gunichar ch; diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h index 7ba5a5db62..9e1feb9032 100644 --- a/gtk/gtkprivate.h +++ b/gtk/gtkprivate.h @@ -112,6 +112,16 @@ gboolean _gtk_fnmatch (const char *pattern, #define GTK_DEFAULT_ACCEL_MOD_MASK GDK_META_MASK #endif +/* When any of these modifiers are active, a key + * event cannot produce a symbol, so should be + * skipped when handling text input + */ +#ifndef GDK_WINDOWING_QUARTZ +#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD1_MASK | GDK_CONTROL_MASK) +#else +#define GTK_NO_TEXT_INPUT_MOD_MASK (GDK_MOD2_MASK | GDK_CONTROL_MASK) +#endif + G_END_DECLS #endif /* __GTK_PRIVATE_H__ */