From 57f0c68c947e1ff9d477399beceb20f791022fc4 Mon Sep 17 00:00:00 2001 From: Peter Hedlund Date: Mon, 10 Jul 2017 19:18:38 -0700 Subject: [PATCH 1/2] - Disable native window tabbing on macOS. - Hide the menu item to show/hide the menu bar. It has no effect and meaning on macOS. --- rssguard.pro | 7 +++++-- src/gui/dialogs/formmain.cpp | 6 ++++++ src/main.cpp | 2 ++ src/miscellaneous/disablewindowtabbing.mm | 11 +++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/miscellaneous/disablewindowtabbing.mm diff --git a/rssguard.pro b/rssguard.pro index 10a900033..e7c5d5240 100755 --- a/rssguard.pro +++ b/rssguard.pro @@ -459,8 +459,10 @@ SOURCES += src/core/feeddownloader.cpp \ src/core/messagesmodelcache.cpp \ src/core/messagesmodelsqllayer.cpp \ src/gui/treeviewcolumnsmenu.cpp \ - src/services/abstract/labelsrootitem.cpp \ - src/services/abstract/label.cpp + src/services/abstract/labelsrootitem.cpp \ + src/services/abstract/label.cpp + +OBJECTIVE_SOURCES += src/miscellaneous/disablewindowtabbing.mm FORMS += src/gui/toolbareditor.ui \ src/network-web/downloaditem.ui \ @@ -763,6 +765,7 @@ mac { ICON = resources/macosx/$${TARGET}.icns QMAKE_MAC_SDK = macosx10.12 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 + LIBS += -framework AppKit target.path = $$quote($$PREFIX/Contents/MacOS/) diff --git a/src/gui/dialogs/formmain.cpp b/src/gui/dialogs/formmain.cpp index 5a1aee3db..4c144c945 100755 --- a/src/gui/dialogs/formmain.cpp +++ b/src/gui/dialogs/formmain.cpp @@ -138,7 +138,9 @@ QList FormMain::allActions() const { actions << m_ui->m_actionAboutGuard; actions << m_ui->m_actionSwitchFeedsList; actions << m_ui->m_actionSwitchMainWindow; +#if !defined(Q_OS_MAC) actions << m_ui->m_actionSwitchMainMenu; +#endif actions << m_ui->m_actionSwitchToolBars; actions << m_ui->m_actionSwitchListHeaders; actions << m_ui->m_actionSwitchStatusBar; @@ -211,6 +213,10 @@ void FormMain::prepareMenus() { m_ui->m_menuWebBrowserTabs->removeAction(m_ui->m_actionTabNewWebBrowser); m_ui->m_menuWebBrowserTabs->setTitle(tr("Tabs")); #endif + +#if defined(Q_OS_MAC) + m_ui->m_actionSwitchMainMenu->setVisible(false); +#endif } void FormMain::switchFullscreenMode() { diff --git a/src/main.cpp b/src/main.cpp index 32739ccf7..bee16db02 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,6 +39,7 @@ #include #include +extern void disableWindowTabbing(); int main(int argc, char *argv[]) { for (int i = 0; i < argc; i++) { @@ -85,6 +86,7 @@ int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #ifdef Q_OS_MAC QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); + disableWindowTabbing(); #endif // Register needed metatypes. diff --git a/src/miscellaneous/disablewindowtabbing.mm b/src/miscellaneous/disablewindowtabbing.mm new file mode 100644 index 000000000..964187edc --- /dev/null +++ b/src/miscellaneous/disablewindowtabbing.mm @@ -0,0 +1,11 @@ + +#import + +// Disables auto window tabbing where supported, otherwise a no-op. +// See http://lists.qt-project.org/pipermail/interest/2016-September/024488.html +void disableWindowTabbing() +{ + if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)]) { + NSWindow.allowsAutomaticWindowTabbing = NO; + } +} From a4702fe9893a2a4e487856460f49b3b2922f8d77 Mon Sep 17 00:00:00 2001 From: Peter Hedlund Date: Mon, 10 Jul 2017 19:33:06 -0700 Subject: [PATCH 2/2] Also hide the full screen menu item. Handled natively by macOS. --- src/gui/dialogs/formmain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/dialogs/formmain.cpp b/src/gui/dialogs/formmain.cpp index 4c144c945..d119dc775 100755 --- a/src/gui/dialogs/formmain.cpp +++ b/src/gui/dialogs/formmain.cpp @@ -134,7 +134,9 @@ QList FormMain::allActions() const { actions << m_ui->m_actionBackupDatabaseSettings; actions << m_ui->m_actionRestart; actions << m_ui->m_actionQuit; +#if !defined(Q_OS_MAC) actions << m_ui->m_actionFullscreen; +#endif actions << m_ui->m_actionAboutGuard; actions << m_ui->m_actionSwitchFeedsList; actions << m_ui->m_actionSwitchMainWindow; @@ -216,6 +218,7 @@ void FormMain::prepareMenus() { #if defined(Q_OS_MAC) m_ui->m_actionSwitchMainMenu->setVisible(false); + m_ui->m_actionFullscreen->setVisible(false); #endif }