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



commit 2a8be23d1717a9b48d957a7ccfce9032b1e18a64
Author: Michael Natterer <mitch lanedo com>
Date:   Fri Sep 16 16:10:06 2011 +0200

    gtk: fix entering of Option-foo symbols on the Mac
    
    define GTK_NO_TEXT_INPUT_MOD_MASK in gtkprivate.h
    and use it in the IM contexts, so Option-foo is no longer
    filtered away.

 gtk/gtkimcontextsimple.c |    2 +-
 gtk/gtkimmulticontext.c  |    2 +-
 gtk/gtkprivate.h         |   10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 68f7578..1ef6b16 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -895,7 +895,7 @@ 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 & (GDK_MOD1_MASK | GDK_CONTROL_MASK) ||
+      if (event->state & GTK_NO_TEXT_INPUT_MOD_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 ea471a8..28a218d 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -350,7 +350,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 458a4b9..d92affe 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -67,6 +67,16 @@ 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
+
 gboolean _gtk_fnmatch      (const char *pattern,
                             const char *string,
                             gboolean    no_leading_period);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]