From 74f17d2882bf39a71947e6455829620f7284fcd1 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 19 Mar 2016 14:46:11 +0000 Subject: [PATCH] Fix missing menubar on Mac in some setups MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Only clear the OSG ‘pose as standalone’ flag when we really show a dialog, as opposed to when we /might/ show. Tested: - Qt build using launcher - No Qt build - Qt build but launcher not requested --- src/GUI/QtLauncher.cxx | 8 ++++---- src/GUI/SetupRootDialog.cxx | 5 +++++ src/Viewer/WindowBuilder.cxx | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/GUI/QtLauncher.cxx b/src/GUI/QtLauncher.cxx index 3cc0f201d..8d31c6725 100644 --- a/src/GUI/QtLauncher.cxx +++ b/src/GUI/QtLauncher.cxx @@ -357,10 +357,6 @@ void initApp(int& argc, char** argv) ::setlocale(LC_NUMERIC, "C"); ::setlocale(LC_COLLATE, "C"); - // avoid double Apple menu and other weirdness if both Qt and OSG - // try to initialise various Cocoa structures. - flightgear::WindowBuilder::setPoseAsStandaloneApp(false); - Qt::KeyboardModifiers mods = app->queryKeyboardModifiers(); if (mods & (Qt::AltModifier | Qt::ShiftModifier)) { qWarning() << "Alt/shift pressed during launch"; @@ -427,6 +423,10 @@ bool runLauncherDialog() loadNaturalEarthData(); + // avoid double Apple menu and other weirdness if both Qt and OSG + // try to initialise various Cocoa structures. + flightgear::WindowBuilder::setPoseAsStandaloneApp(false); + QtLauncher dlg; dlg.show(); diff --git a/src/GUI/SetupRootDialog.cxx b/src/GUI/SetupRootDialog.cxx index 93999f476..027418e50 100644 --- a/src/GUI/SetupRootDialog.cxx +++ b/src/GUI/SetupRootDialog.cxx @@ -40,6 +40,7 @@ #include
#include
#include +#include SetupRootDialog::SetupRootDialog(PromptState prompt) : QDialog(), @@ -76,6 +77,10 @@ bool SetupRootDialog::runDialog(bool usingDefaultRoot) bool SetupRootDialog::runDialog(PromptState prompt) { + // avoid double Apple menu and other weirdness if both Qt and OSG + // try to initialise various Cocoa structures. + flightgear::WindowBuilder::setPoseAsStandaloneApp(false); + SetupRootDialog dlg(prompt); dlg.exec(); if (dlg.result() != QDialog::Accepted) { diff --git a/src/Viewer/WindowBuilder.cxx b/src/Viewer/WindowBuilder.cxx index 06d94e118..ec21bde69 100644 --- a/src/Viewer/WindowBuilder.cxx +++ b/src/Viewer/WindowBuilder.cxx @@ -25,7 +25,7 @@ #include -#if defined(HAVE_QT) && defined(SG_MAC) +#if defined(SG_MAC) #include #endif @@ -253,7 +253,7 @@ GraphicsWindow* WindowBuilder::getDefaultWindow() = new GraphicsContext::Traits(*defaultTraits); traits->windowName = "FlightGear"; -#if defined(HAVE_QT) && defined(SG_MAC) +#if defined(SG_MAC) int flags = osgViewer::GraphicsWindowCocoa::WindowData::CheckForEvents; // avoid both QApplication and OSG::CocoaViewer doing single-application -- 2.39.5