[Spice-devel] [spice-gtk 3/3] Send Hangul key in KR keyboard

Takao Fujiwara tfujiwar at redhat.com
Wed Apr 6 04:33:13 UTC 2016


Korean keyboard assigns Hangul key on the position of Right Alt and
Left Alt and Hangul keys have the different scancodes but
MapVirtualKey()
returned the same scancode and could not use Hangul key on Linux
desktop.

The fix is to send the right scancode of VK_HANGUL.
---
 src/spice-widget.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 5242288..5e7c98a 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -30,6 +30,7 @@
 #endif
 #ifdef G_OS_WIN32
 #include <windows.h>
+#include <dinput.h>
 #include <ime.h>
 #include <gdk/gdkwin32.h>
 #ifndef MAPVK_VK_TO_VSC /* may be undefined in older mingw-headers */
@@ -1534,6 +1535,15 @@ static gboolean key_event(GtkWidget *widget,
GdkEventKey *key)
             }
         }
         break;
+    case MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN):
+        if (key->hardware_keycode == VK_HANGUL && native_scancode ==
DIK_LALT) {
+            /* Left Alt (VK_MENU) has the scancode DIK_LALT (0x38) but
+             * Hangul (VK_HANGUL) has the scancode 0x138
+             */
+            scancode = native_scancode | 0x100;
+            goto got_scancode;
+        }
+        break;
     default:;
     }
 
-- 
2.5.0


More information about the Spice-devel mailing list