Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Auto-Type modifiers on Windows #7629

Merged
merged 2 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/topics/AutoType.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ image::autotype_entry_sequences.png[]
|{PICKCHARS} |Pick specific password characters from a dialog
|{MODE=VIRTUAL} |(Experimental) Use virtual key presses on Windows, useful for virtual machines
|===
+
[grid=rows, frame=none, width=90%]
|===
|Modifier |Description

|+ |SHIFT
|^ |CTRL
|% |ALT
|# |WIN/CMD
|===

TIP: Use modifiers to hold down special keys before typing the next character. For example, to type *CTRL+SHIFT+D* use: `^+d`. This is useful if you need to activate certain actions in a program or on your desktop.

=== Performing Global Auto-Type
The global Auto-Type keyboard shortcut is used when you have focus on the window you want to type into. To make use of this feature, you must have previously configured an Auto-Type hotkey.
Expand Down
9 changes: 9 additions & 0 deletions docs/topics/Reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ Examples: +
|{PICKCHARS} |Pick specific password characters from a dialog
|===

[grid=rows, frame=none, width=90%]
|===
|Modifier |Description

|+ |SHIFT
|^ |CTRL
|% |ALT
|# |WIN/CMD
|===
*Text Conversions:*

`{T-CONV:/<PLACEHOLDER>/<METHOD>/}` +
Expand Down
28 changes: 17 additions & 11 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,20 @@ namespace
{"multiply", Qt::Key_Asterisk},
{"divide", Qt::Key_Slash},
{"leftbrace", Qt::Key_BraceLeft},
{"{", Qt::Key_BraceLeft},
{"{", Qt::Key_unknown},
{"rightbrace", Qt::Key_BraceRight},
{"}", Qt::Key_BraceRight},
{"}", Qt::Key_unknown},
{"leftparen", Qt::Key_ParenLeft},
{"(", Qt::Key_ParenLeft},
{"(", Qt::Key_unknown},
{"rightparen", Qt::Key_ParenRight},
{")", Qt::Key_ParenRight},
{"[", Qt::Key_BracketLeft},
{"]", Qt::Key_BracketRight},
{"+", Qt::Key_Plus},
{"%", Qt::Key_Percent},
{"^", Qt::Key_AsciiCircum},
{"~", Qt::Key_AsciiTilde},
{")", Qt::Key_unknown},
{"[", Qt::Key_unknown},
{"]", Qt::Key_unknown},
{"+", Qt::Key_unknown},
{"%", Qt::Key_unknown},
{"^", Qt::Key_unknown},
{"~", Qt::Key_unknown},
{"#", Qt::Key_unknown},
{"numpad0", Qt::Key_0},
{"numpad1", Qt::Key_1},
{"numpad2", Qt::Key_2},
Expand Down Expand Up @@ -612,7 +613,12 @@ AutoType::parseSequence(const QString& entrySequence, const Entry* entry, QStrin
error = tr("Too many repetitions detected, max is %1: %2").arg(maxRepetition).arg(fullPlaceholder);
return {};
}
auto action = QSharedPointer<AutoTypeKey>::create(g_placeholderToKey[placeholder], modifiers);
QSharedPointer<AutoTypeKey> action;
if (g_placeholderToKey[placeholder] == Qt::Key_unknown) {
action = QSharedPointer<AutoTypeKey>::create(placeholder[0], modifiers);
} else {
action = QSharedPointer<AutoTypeKey>::create(g_placeholderToKey[placeholder], modifiers);
}
for (int i = 1; i <= repeat && i <= maxRepetition; ++i) {
actions << action;
}
Expand Down
2 changes: 1 addition & 1 deletion src/autotype/windows/AutoTypeWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ AutoTypeAction::Result AutoTypeExecutorWin::execType(const AutoTypeKey* action)
m_platform->setKeyState(action->key, true);
m_platform->setKeyState(action->key, false);
} else {
if (mode == Mode::VIRTUAL) {
if (mode == Mode::VIRTUAL || action->modifiers != Qt::NoModifier) {
m_platform->sendCharVirtual(action->character);
} else {
m_platform->sendChar(action->character);
Expand Down