[gtk+] gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
- Date: Tue, 27 Sep 2011 09:35:15 +0000 (UTC)
commit 0abe8ce27b44a1520e2a650c97c6f78f89f4690a
Author: Michael Natterer <mitch lanedo com>
Date: Tue Sep 27 11:34:19 2011 +0200
gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
and use the new public modifier abstraction API.
gtk/gtkfilechooserdefault.c | 6 +++++-
gtk/gtkimcontextsimple.c | 11 ++++++++++-
gtk/gtkimmulticontext.c | 38 ++++++++++++++++++++++++++------------
gtk/gtkprivate.h | 10 ----------
4 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 5ea074d..8c3db4c 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -3724,15 +3724,19 @@ browse_files_key_press_event_cb (GtkWidget *widget,
gpointer data)
{
GtkFileChooserDefault *impl;
+ GdkModifierType no_text_input_mask;
impl = (GtkFileChooserDefault *) data;
+ no_text_input_mask =
+ gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
+
if ((event->keyval == GDK_KEY_slash
|| event->keyval == GDK_KEY_KP_Divide
#ifdef G_OS_UNIX
|| event->keyval == GDK_KEY_asciitilde
#endif
- ) && !(event->state & GTK_NO_TEXT_INPUT_MOD_MASK))
+ ) && !(event->state & no_text_input_mask))
{
location_popup_handler (impl, event->string);
return TRUE;
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 1ef6b16..7210824 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -895,7 +895,16 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
(priv->in_hex_sequence && !hex_keyval &&
!is_hex_start && !is_hex_end && !is_escape && !is_backspace))
{
- if (event->state & GTK_NO_TEXT_INPUT_MOD_MASK ||
+ GdkDisplay *display;
+ GdkModifierType no_text_input_mask;
+
+ 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->state & no_text_input_mask ||
(priv->in_hex_sequence && priv->modifiers_dropped &&
(event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_ISO_Enter ||
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 28a218d..5ad4ec6 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;
+ }
}
}
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 5778958..b8bb90e 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -67,16 +67,6 @@ const gchar *_gtk_get_data_prefix ();
#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
-
#ifndef GDK_WINDOWING_QUARTZ
#define GTK_EXTEND_SELECTION_MOD_MASK GDK_SHIFT_MASK
#define GTK_MODIFY_SELECTION_MOD_MASK GDK_CONTROL_MASK
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]