Skip to content

Commit

Permalink
Prevent AltGr showing the menubar on Windows
Browse files Browse the repository at this point in the history
* Fixes #11549
  • Loading branch information
droidmonkey committed Dec 28, 2024
1 parent fb022cb commit 4c2d4de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,15 @@ bool MainWindowEventFilter::eventFilter(QObject* watched, QEvent* event)
#endif
} else if (eventType == QEvent::KeyRelease && watched == mainWindow) {
auto keyEvent = dynamic_cast<QKeyEvent*>(event);
#ifdef Q_OS_WIN
// Windows translates AltGr into CTRL + ALT, this breaks using AltGr when the menubar is hidden
// Prevent this by activating the ALT cooldown to ignore the next key event which will be an ALT key
if (keyEvent->key() == Qt::Key_Control && keyEvent->modifiers() == Qt::AltModifier
&& config()->get(Config::GUI_HideMenubar).toBool()) {
m_altCoolDown.start();
return false;
}
#endif
if (keyEvent->key() == Qt::Key_Alt && !keyEvent->modifiers() && config()->get(Config::GUI_HideMenubar).toBool()
&& !m_altCoolDown.isActive()) {
auto menubar = mainWindow->m_ui->menubar;
Expand Down

0 comments on commit 4c2d4de

Please sign in to comment.