Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kuznetsov <kuzsasha@gmail.com>2011-10-21 21:40:35 +0400
committerAlexander Kuznetsov <kuzsasha@gmail.com>2011-10-21 21:40:35 +0400
commitc9035e20d0033e897aaea9ed761002ec02331ce4 (patch)
treef3c863ff6099623e05191c107adde4423031bcfc /intern/ghost
parent00735ed9e49d2103e06b0e25513b5b880f0db226 (diff)
UTF8 input support for Windows.
ToDo: * add support for dead keys * other input methods (for hieroglyphs)
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 24b6474732e..99ce81165ad 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -712,21 +712,21 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
GHOST_SystemWin32 * system = (GHOST_SystemWin32 *)getSystem();
GHOST_TKey key = system->hardKey(window, raw, &keyDown, &vk);
GHOST_EventKey* event;
+
if (key != GHOST_kKeyUnknown) {
- char ascii = '\0';
+ char utf8_char[6] = {0} ;
- unsigned short utf16[2]={0};
+ wchar_t utf16[2]={0};
BYTE state[256];
- GetKeyboardState((PBYTE)state);
+ GetKeyboardState((PBYTE)state);
- if(ToAsciiEx(vk, 0, state, utf16, 0, system->m_keylayout))
- WideCharToMultiByte(CP_ACP, 0x00000400,
+ if(ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))
+ WideCharToMultiByte(CP_UTF8, 0,
(wchar_t*)utf16, 1,
- (LPSTR) &ascii, 1,
- NULL,NULL);
-
- /* TODO, last arg is utf8, need to pass utf8 arg */
- event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, NULL);
+ (LPSTR) utf8_char, 5,
+ NULL,NULL); else *utf8_char = 0;
+
+ event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, (*utf8_char & 0x80)?'?':*utf8_char, utf8_char);
#ifdef GHOST_DEBUG
std::cout << ascii << std::endl;