summaryrefslogtreecommitdiff
path: root/gtk/gtkimmulticontext.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@lanedo.com>2011-09-27 11:34:19 +0200
committerMichael Natterer <mitch@gimp.org>2011-09-27 11:34:19 +0200
commit0abe8ce27b44a1520e2a650c97c6f78f89f4690a (patch)
treebb945a2280ca2b395ff29a5e6f8081046744723a /gtk/gtkimmulticontext.c
parent4a7a67339a3c8a7c523b32b36a7fc2ea5abfb8f8 (diff)
downloadgtk+-0abe8ce27b44a1520e2a650c97c6f78f89f4690a.tar.gz
gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
and use the new public modifier abstraction API.
Diffstat (limited to 'gtk/gtkimmulticontext.c')
-rw-r--r--gtk/gtkimmulticontext.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 28a218d65b..5ad4ec670f 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -348,24 +348,38 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
if (slave)
- return gtk_im_context_filter_keypress (slave, event);
- else if (event->type == GDK_KEY_PRESS &&
- (event->state & GTK_NO_TEXT_INPUT_MOD_MASK) == 0)
{
- gunichar ch;
+ return gtk_im_context_filter_keypress (slave, event);
+ }
+ else
+ {
+ GdkDisplay *display;
+ GdkModifierType no_text_input_mask;
- ch = gdk_keyval_to_unicode (event->keyval);
- if (ch != 0 && !g_unichar_iscntrl (ch))
+ display = gdk_window_get_display (event->window);
+
+ no_text_input_mask =
+ gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
+
+ if (event->type == GDK_KEY_PRESS &&
+ (event->state & no_text_input_mask) == 0)
{
- gint len;
- gchar buf[10];
+ gunichar ch;
+
+ ch = gdk_keyval_to_unicode (event->keyval);
+ if (ch != 0 && !g_unichar_iscntrl (ch))
+ {
+ gint len;
+ gchar buf[10];
- len = g_unichar_to_utf8 (ch, buf);
- buf[len] = '\0';
+ len = g_unichar_to_utf8 (ch, buf);
+ buf[len] = '\0';
- g_signal_emit_by_name (multicontext, "commit", buf);
+ g_signal_emit_by_name (multicontext, "commit", buf);
- return TRUE;
+ return TRUE;
+ }
}
}