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

Frediano Ziglio fziglio at redhat.com
Fri Apr 15 11:11:09 UTC 2016


From: Takao Fujiwara <tfujiwar at redhat.com>

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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 4878e00..617cd26 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 */
@@ -1487,6 +1488,14 @@ 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;
+        }
+        break;
     }
 
     /* Emulate KeyRelease events for the following keys.
-- 
2.5.5



More information about the Spice-devel mailing list