aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorKenneth Chew <kenneth.c0@protonmail.com>2022-04-08 17:00:42 -0400
committerKenneth Chew <kenneth.c0@protonmail.com>2022-04-08 17:00:42 -0400
commit9f3eed6ca25fdf773dfd38a7a86fba0ee7d67f5c (patch)
tree638bbf821f1f500c35b7216199994074fb0d2026 /launcher
parentab82358dcb327a1a8ee19e102ce79c260e4f1241 (diff)
downloadPrismLauncher-9f3eed6ca25fdf773dfd38a7a86fba0ee7d67f5c.tar.gz
PrismLauncher-9f3eed6ca25fdf773dfd38a7a86fba0ee7d67f5c.tar.bz2
PrismLauncher-9f3eed6ca25fdf773dfd38a7a86fba0ee7d67f5c.zip
Fix typos causing build failures on non-macOS systems
It also did the exact opposite thing I was trying to do, so that's fixed too...
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/MainWindow.cpp7
-rw-r--r--launcher/ui/MainWindow.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index b98cd8b7..895b9881 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -1099,11 +1099,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
// macOS always has a native menu bar, so these fixes are not applicable
// Other systems may or may not have a native menu bar (most do not - it seems like only Ubuntu Unity does)
-#ifdef Q_OS_MAC
+#ifndef Q_OS_MAC
void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Alt)
ui->menuBar->setVisible(!ui->menuBar->isVisible());
+ else
+ QMainWindow::keyReleaseEvent(event);
}
// FIXME: This is a hack because keyboard shortcuts do nothing while menu bar is hidden on systems without native menu bar
@@ -1111,7 +1113,10 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if(ui->menuBar->isVisible() || ui->menuBar->isNativeMenuBar())
+ {
+ QMainWindow::keyPressEvent(event);
return; // let the menu bar handle the keyboard shortcuts
+ }
if(event->modifiers().testFlag(Qt::ControlModifier))
{
diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h
index 4ce4b7db..c38ee073 100644
--- a/launcher/ui/MainWindow.h
+++ b/launcher/ui/MainWindow.h
@@ -186,9 +186,11 @@ private slots:
void globalSettingsClosed();
+#ifndef Q_OS_MAC
void keyReleaseEvent(QKeyEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
+#endif
private:
void retranslateUi();