From 4d6d3e7ae5c43d93f664b116006fc9f1c9a4a5d3 Mon Sep 17 00:00:00 2001 From: caro Date: Tue, 29 Nov 2011 23:06:01 +0000 Subject: [PATCH] Ecore_Win32 : Fix the key release values for non keystroke keys (Windows XP) git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@65695 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 1 + src/lib/ecore_win32/ecore_win32.c | 2 +- src/lib/ecore_win32/ecore_win32_event.c | 29 +++++++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 963c64b..4f3f4c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -355,3 +355,4 @@ * Discard left Ctrl when AltGr is pressed (Windows XP) * Fix the string value for the Delete key (Windows XP) + * Fix the key release values for non keystroke keys (Windows XP) diff --git a/src/lib/ecore_win32/ecore_win32.c b/src/lib/ecore_win32/ecore_win32.c index ba61493..b571d74 100644 --- a/src/lib/ecore_win32/ecore_win32.c +++ b/src/lib/ecore_win32/ecore_win32.c @@ -132,7 +132,7 @@ _ecore_win32_window_procedure(HWND window, * we check if the next message * - is a WM_KEYUP or WM_SYSKEYUP * - has the same timestamp than the Ctrl one - * - is the key press of the right Alt key + * - is the key release of the right Alt key */ res = PeekMessage(&next_msg, data->window, WM_KEYUP, WM_SYSKEYUP, diff --git a/src/lib/ecore_win32/ecore_win32_event.c b/src/lib/ecore_win32/ecore_win32_event.c index 159d3f9..c12562d 100644 --- a/src/lib/ecore_win32/ecore_win32_event.c +++ b/src/lib/ecore_win32/ecore_win32_event.c @@ -650,6 +650,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, char **keycompose, unsigned int *modifiers) { + WCHAR buf[3]; char delete_string[2] = { 0x7f, 0 }; char *kn = NULL; char *ks = NULL; @@ -1115,8 +1116,32 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, kc = ""; break; default: - /* other non keystroke characters */ - return 0; + { + /* other non keystroke characters */ + BYTE kbd_state[256]; + int res; + + if (is_down) + return 0; + + if (!GetKeyboardState(kbd_state)) + return 0; + + res = ToUnicode(msg->window_param, + MapVirtualKey(msg->window_param, 2), + kbd_state, buf, 3, 0); + if (res == 1) + { + /* FIXME: might be troublesome for non european languages */ + /* in that case, UNICODE should be used, I guess */ + buf[1] = '\0'; + kn = (char *)buf; + ks = (char *)buf; + kc = (char *)buf; + break; + } + return 0; + } } *keyname = strdup(kn); -- 2.7.4