linux-packaging-mono/external/bockbuild/packages/patches/gtk/bgo702841-fix-kana-eisu-keys.patch

65 lines
2.0 KiB
Diff
Raw Normal View History

From b93535cc5d60149edc3a45d5b7f31f62a80234bf Mon Sep 17 00:00:00 2001
From: Takuro Ashie <ashie@clear-code.com>
Date: Fri, 21 Jun 2013 21:29:14 +0900
Subject: [PATCH] Quartz: translate JIS Hiragana & Eisu keys.
Since UCKeyTranslate() converts these keys to Space key unexpectedly,
applications can't distinguish these keys by keysyms.
To solve it, this fix translates these keys by same way with function
keys & keypad keys.
---
gdk/quartz/gdkkeys-quartz.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
index a4df2cf..fb11c33 100644
--- a/gdk/quartz/gdkkeys-quartz.c
+++ b/gdk/quartz/gdkkeys-quartz.c
@@ -191,6 +191,29 @@ const static struct {
{ 92, GDK_KEY_9, GDK_KEY_KP_9 }
};
+/* Keys only in JIS layout.
+ * The rationale of these key codes is <HIToolbox/Events.h> in Carbon.
+ */
+const static struct {
+ guint keycode;
+ guint keyval;
+} jis_keys[] = {
+#if 0
+ /* Although These keys are also defined in <HIToolbox/Events.h>, they can be
+ * translated by UCKeyTranslate correctly.
+ */
+ { 0x5D, GDK_KEY_yen },
+ { 0x5E, GDK_KEY_underscore },
+ { 0x5F, GDK_KEY_comma },
+#endif
+ /* These keys are unexpectedly translated to Space key by UCKeyTranslate,
+ * and there is no suitable ucs value for them to add to special_ucs_table.
+ * So we should translate them particularly.
+ */
+ { 0x66 /* 102 */, GDK_KEY_Eisu_toggle },
+ { 0x68 /* 104 */, GDK_KEY_Hiragana }
+};
+
/* These values aren't covered by gdk_unicode_to_keyval */
const static struct {
gunichar ucs_value;
@@ -498,6 +521,14 @@ maybe_update_keymap (void)
if (p[0] == known_numeric_keys[i].normal_keyval)
p[0] = known_numeric_keys[i].keypad_keyval;
}
+
+ for (i = 0; i < G_N_ELEMENTS (jis_keys); i++)
+ {
+ p = keyval_array + jis_keys[i].keycode * KEYVALS_PER_KEYCODE;
+
+ p[0] = jis_keys[i].keyval;
+ p[1] = p[2] = p[3] = 0;
+ }
if (current_layout)
g_signal_emit_by_name (default_keymap, "keys_changed");
--
1.7.12.4 (Apple Git-37)