Fix cmd+z for undo not working when editing text objects on OS X.

This commit is contained in:
Brecht Van Lommel 2016-02-13 21:07:32 +01:00
parent 88770bed7c
commit 701a4a4e09
1 changed files with 5 additions and 5 deletions

View File

@ -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);