[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54761] trunk/blender/intern/ghost/intern/ GHOST_SystemWin32.cpp: Applying patch #33709 for dead keys on windows.
Alexander Kuznetsov
kuzsasha at gmail.com
Fri Feb 22 17:42:20 CET 2013
Revision: 54761
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54761
Author: alexk
Date: 2013-02-22 16:42:19 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
Applying patch #33709 for dead keys on windows.
Thanks Harley Acheson!
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2013-02-22 16:11:27 UTC (rev 54760)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2013-02-22 16:42:19 UTC (rev 54761)
@@ -296,6 +296,9 @@
// Process all the events waiting for us
while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE) != 0) {
+ // TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data.
+ // Needed for MapVirtualKey or if we ever need to get chars from wm_ime_char or similar.
+ ::TranslateMessage(&msg);
::DispatchMessageW(&msg);
anyProcessed = true;
}
@@ -729,14 +732,18 @@
int r;
GetKeyboardState((PBYTE)state);
- if ((r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))) {
- if ((r > 0 && r < 3)) {
- utf16[r] = 0;
- conv_utf_16_to_8(utf16, utf8_char, 6);
+ // don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical composition.
+ if (MapVirtualKeyW(vk,2) != 0) {
+ // todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here). Could be up to 24 utf8 bytes.
+ if ((r = ToUnicodeEx(vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
+ if ((r > 0 && r < 3)) {
+ utf16[r] = 0;
+ conv_utf_16_to_8(utf16, utf8_char, 6);
+ }
+ else if (r == -1) {
+ utf8_char[0] = '\0';
+ }
}
- else if (r == -1) {
- utf8_char[0] = '\0';
- }
}
if (!keyDown) {
More information about the Bf-blender-cvs
mailing list