diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-13 23:07:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-14 00:54:02 +0300 |
commit | 701a4a4e09343cc57d53a8767e609cf8da2ec945 (patch) | |
tree | 3fdcb8ae6c4bab1e035695ad092b3e079d614665 /intern/ghost | |
parent | 88770bed7c1125870f555978bb45ef837b70b9fb (diff) |
Fix cmd+z for undo not working when editing text objects on OS X.
Diffstat (limited to 'intern/ghost')
-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); |