diff options
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 73d501252e4..4db945d31f7 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1548,11 +1548,6 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) for (int x = 0; x < [convertedCharacters length]; x++) { utf8_buf[x] = ((char*)[convertedCharacters bytes])[x]; } - - /* ascii is a subset of unicode */ - if ([convertedCharacters length] == 1) { - ascii = utf8_buf[0]; - } } /* arrow keys should not have utf8 */ @@ -1570,6 +1565,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask)) break; //Cmd-Q is directly handled by Cocoa + /* ascii is a subset of unicode */ + if (utf8_buf[0] && !utf8_buf[1]) { + ascii = utf8_buf[0]; + } + if ([event type] == NSKeyDown) { pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); |