[gtk+] quartz: add a special case to GtkIMContextSimply for entering '"'



commit c1cfcd03a550e0b79c563a2de3c9f6fb5f9b134f
Author: Michael Natterer <mitch lanedo com>
Date:   Thu May 10 10:57:16 2012 +0200

    quartz: add a special case to GtkIMContextSimply for entering '"'
    
    Turn dead_doubleacute plus space into '"' and not into a double
    acute because that's the way to enter double quotes on the
    US-International keyboard layout.
    (cherry picked from commit 71164e57b9b999f07a613806058ee87b9cbf882d)

 gtk/gtkimcontextsimple.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 5cd62aa..e426c6b 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -364,6 +364,40 @@ check_win32_special_case_after_compact_match (GtkIMContextSimple    *context_sim
 
 #endif
 
+#ifdef GDK_WINDOWING_QUARTZ
+
+static gboolean
+check_quartz_special_cases (GtkIMContextSimple *context_simple,
+                            gint                n_compose)
+{
+  GtkIMContextSimplePrivate *priv = context_simple->priv;
+
+  if (n_compose == 2 &&
+      priv->compose_buffer[1] == GDK_KEY_space)
+    {
+      gunichar value = 0;
+
+      switch (priv->compose_buffer[0])
+        {
+        case GDK_KEY_dead_doubleacute:
+          value = '"'; break;
+        }
+
+      if (value > 0)
+        {
+          gtk_im_context_simple_commit_char (GTK_IM_CONTEXT (context_simple), value);
+          priv->compose_buffer[0] = 0;
+
+          GTK_NOTE (MISC, g_print ("quartz: U+%04X\n", value));
+          return TRUE;
+        }
+    }
+
+  return FALSE;
+}
+
+#endif
+
 static gboolean
 check_compact_table (GtkIMContextSimple           *context_simple,
                      const GtkComposeTableCompact *table,
@@ -1068,6 +1102,11 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
 	return TRUE;
 #endif
 
+#ifdef GDK_WINDOWING_QUARTZ
+      if (check_quartz_special_cases (context_simple, n_compose))
+        return TRUE;
+#endif
+
       if (check_compact_table (context_simple, &gtk_compose_table_compact, n_compose))
         return TRUE;
   



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