gtk: fix entering of Option-foo symbols on the Mac

and use it in the IM contexts, so Option-foo is no longer
filtered away.
This commit is contained in:
Michael Natterer 2011-09-16 16:10:06 +02:00 committed by Michael Natterer
parent 659df720ca
commit 812678a70c
3 changed files with 12 additions and 2 deletions

View File

@ -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 ||

View File

@ -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;

View File

@ -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__ */