Fix Cmd+[ shortcut to go back in the file selector on macOS

This commit is contained in:
David Capello 2016-11-24 18:47:51 -03:00
parent 33d6ffb73b
commit 422dcba69b
2 changed files with 7 additions and 8 deletions

View File

@ -198,8 +198,8 @@ protected:
int unicode = keyMsg->unicodeChar(); int unicode = keyMsg->unicodeChar();
bool up = (msg->cmdPressed() && scancode == kKeyUp); bool up = (msg->cmdPressed() && scancode == kKeyUp);
bool enter = (msg->cmdPressed() && scancode == kKeyDown); bool enter = (msg->cmdPressed() && scancode == kKeyDown);
bool back = (msg->cmdPressed() && msg->shiftPressed() && unicode == '['); bool back = (msg->cmdPressed() && (unicode == '[' || scancode == kKeyOpenbrace));
bool forward = (msg->cmdPressed() && msg->shiftPressed() && unicode == ']'); bool forward = (msg->cmdPressed() && (unicode == ']' || scancode == kKeyClosebrace));
#else #else
bool up = (msg->altPressed() && scancode == kKeyUp); bool up = (msg->altPressed() && scancode == kKeyUp);
bool enter = (msg->altPressed() && scancode == kKeyDown); bool enter = (msg->altPressed() && scancode == kKeyDown);

View File

@ -32,12 +32,11 @@ retry:;
inMode:NSDefaultRunLoopMode inMode:NSDefaultRunLoopMode
dequeue:YES]; dequeue:YES];
if (event) { if (event) {
// Intercept Control+Tab and send it to the main NSView. Without // Intercept <Control+Tab>, <Cmd+[>, and other keyboard
// this, the NSApplication intercepts the key combination and // combinations, and send them directly to the main
// use it to go to the next key view. // NSView. Without this, the NSApplication intercepts the key
if (event.type == NSKeyDown && // combination and use it to go to the next key view.
event.modifierFlags & NSControlKeyMask && if (event.type == NSKeyDown) {
event.keyCode == kVK_Tab) {
[app.mainWindow.contentView keyDown:event]; [app.mainWindow.contentView keyDown:event];
} }
else { else {