From d90b32a7c94d5ca1df85aae0f6e317c6965c71fe Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 11 Sep 2022 09:21:06 -0400 Subject: [PATCH] Support {MODE=VIRTUAL} on macOS * Fix #8433 --- src/autotype/AutoTypeSelectDialog.cpp | 4 ++-- src/autotype/mac/AutoTypeMac.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/autotype/AutoTypeSelectDialog.cpp b/src/autotype/AutoTypeSelectDialog.cpp index 317d2a720..5e5d20c3a 100644 --- a/src/autotype/AutoTypeSelectDialog.cpp +++ b/src/autotype/AutoTypeSelectDialog.cpp @@ -324,7 +324,7 @@ void AutoTypeSelectDialog::buildActionMenu() submitAutoTypeMatch(match); }); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) auto typeVirtualAction = new QAction(icons()->icon("auto-type"), tr("Use Virtual Keyboard")); m_actionMenu->insertAction(copyUsernameAction, typeVirtualAction); typeVirtualAction->setShortcut(Qt::CTRL + Qt::Key_4); @@ -340,7 +340,7 @@ void AutoTypeSelectDialog::buildActionMenu() typeUsernameAction->setShortcutVisibleInContextMenu(true); typePasswordAction->setShortcutVisibleInContextMenu(true); typeTotpAction->setShortcutVisibleInContextMenu(true); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) typeVirtualAction->setShortcutVisibleInContextMenu(true); #endif #endif diff --git a/src/autotype/mac/AutoTypeMac.cpp b/src/autotype/mac/AutoTypeMac.cpp index eb6e4f774..f3f5c6594 100644 --- a/src/autotype/mac/AutoTypeMac.cpp +++ b/src/autotype/mac/AutoTypeMac.cpp @@ -250,6 +250,10 @@ AutoTypeAction::Result AutoTypeExecutorMac::execType(const AutoTypeKey* action) int ch = action->character.toUpper().toLatin1(); m_platform->sendKey(static_cast(ch), true, action->modifiers); m_platform->sendKey(static_cast(ch), false, action->modifiers); + } else if (mode == Mode::VIRTUAL) { + int ch = action->character.toLatin1(); + m_platform->sendKey(static_cast(ch), true, action->modifiers); + m_platform->sendKey(static_cast(ch), false, action->modifiers); } else { m_platform->sendChar(action->character, true); m_platform->sendChar(action->character, false);