This commit is contained in:
OBattler
2023-07-12 00:48:21 +02:00
2 changed files with 11 additions and 0 deletions

View File

@@ -127,3 +127,9 @@ static std::array<uint32_t, 127> cocoa_keycodes = { /* key names in parentheses
0x150, /* DownArrow */
0x148, /* UpArrow */
};
// https://developer.apple.com/documentation/appkit/nseventmodifierflags/
qint32 NSEventModifierFlagCommand = 1 << 20;
qint32 nvk_Delete = 0x75;
qint32 nvk_Insert = 0x72;

View File

@@ -1092,6 +1092,11 @@ MainWindow::processMacKeyboardInput(bool down, const QKeyEvent *event)
if (mac_iso_swap)
nvk = (nvk == 0x0a) ? 0x32 : 0x0a;
}
// Special case for command + forward delete to send insert.
if ((event->nativeModifiers() & NSEventModifierFlagCommand) &&
((event->nativeVirtualKey() == nvk_Delete) || event->key() == Qt::Key_Delete)) {
nvk = nvk_Insert; // Qt::Key_Help according to event->key()
}
processKeyboardInput(down, nvk);
}