Skip to content

Commit

Permalink
better fix for AltGr triggers shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Jul 2, 2024
1 parent 8ad6a93 commit 7027d20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ int main(int argc, char **argv)
qputenv("QT_MEDIA_BACKEND", "darwin");
#elif defined(Q_OS_WIN)
qputenv("QT_MEDIA_BACKEND", "windows");
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM"))
qputenv("QT_QPA_PLATFORM", "windows:altgr");
#else
;
#endif
Expand Down
17 changes: 0 additions & 17 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2288,23 +2288,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)

bool handled = true;

#if defined(Q_OS_WIN)
static auto fixedBrokenCtrlAlt = false;
if (!fixedBrokenCtrlAlt && event->nativeScanCode() == 57400 /* AltGr */
&& event->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) {
LOG_INFO() << "Received AltGr keypress, removing Ctrl+Alt shortcuts";
fixedBrokenCtrlAlt = true;
for (auto &k : Actions.keys()) {
auto shortcuts = Actions[k]->shortcuts();
for (auto &s : shortcuts) {
if (s.toString().startsWith("Ctrl+Alt+"))
shortcuts.removeAll(s);
}
Actions[k]->setShortcuts(shortcuts);
}
}
#endif

switch (event->key()) {
case Qt::Key_J:
if (m_isKKeyPressed)
Expand Down

0 comments on commit 7027d20

Please sign in to comment.