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

Takao Fujiwara tfujiwar at redhat.com
Fri Apr 15 09:09:37 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 bc5a19a..c8e66e6 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 */
@@ -1486,6 +1487,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