[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43913] trunk/blender/intern/ghost/intern/ GHOST_SystemWin32.cpp: Fix for [#30044] on windows

Alexander Kuznetsov kuzsasha at gmail.com
Sun Feb 5 17:05:26 CET 2012


Revision: 43913
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43913
Author:   alexk
Date:     2012-02-05 16:05:20 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Fix for [#30044] on windows

We don't know how ALT key modifies the key, so utf=0;
That way Text Object can handle it.

* Should be removed when we able to support different keyboards on Windows

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	2012-02-05 15:55:28 UTC (rev 43912)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2012-02-05 16:05:20 UTC (rev 43913)
@@ -717,10 +717,11 @@
 
 	if (key != GHOST_kKeyUnknown) {
 		char utf8_char[6] = {0} ;
+		char ascii = 0;
 
 		wchar_t utf16[2]={0};
-		BYTE state[256];
-		GetKeyboardState((PBYTE)state);  
+		BYTE state[256] ={0};
+		GetKeyboardState(state);  
 
 		if(ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))
 			WideCharToMultiByte(CP_UTF8, 0, 
@@ -728,9 +729,14 @@
 									(LPSTR) utf8_char, 5,
 									NULL,NULL); else *utf8_char = 0;
 
-		if(!keyDown) utf8_char[0] = '\0';
 		
-		event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, (*utf8_char & 0x80)?'?':*utf8_char, utf8_char);
+
+		if(!keyDown) {utf8_char[0] = '\0'; ascii='\0';}
+			else ascii = utf8_char[0]& 0x80?'?':utf8_char[0];
+
+		if(0x80&state[VK_MENU]) utf8_char[0]='\0';
+
+		event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, utf8_char);
 		
 #ifdef GHOST_DEBUG
 		std::cout << ascii << std::endl;




More information about the Bf-blender-cvs mailing list