#include <Viewer/WindowSystemAdapter.hxx>
#include <Navaids/NavDataCache.hxx>
#include <Include/version.h>
+#include <Viewer/WindowBuilder.hxx>
#include "fg_commands.hxx"
#include "fg_io.hxx"
showLauncher |= (::getenv("FG_LAUNCHER") != 0);
if (showLauncher) {
+ // avoid double Apple menu and other weirdness if both Qt and OSG
+ // try to initialise various Cocoa structures.
+ flightgear::WindowBuilder::setPoseAsStandaloneApp(false);
+
if (!QtLauncher::runLauncherDialog()) {
return EXIT_SUCCESS;
}
const string WindowBuilder::defaultWindowName("FlightGear");
+// default to true (historical behaviour), we will clear the flag if
+// we run another GUI.
+bool WindowBuilder::poseAsStandaloneApp = true;
+
void WindowBuilder::initWindowBuilder(bool stencil)
{
windowBuilder = new WindowBuilder(stencil);
traits->windowName = "FlightGear";
#if defined(HAVE_QT) && defined(SG_MAC)
+ int flags = osgViewer::GraphicsWindowCocoa::WindowData::CheckForEvents;
+
// avoid both QApplication and OSG::CocoaViewer doing single-application
// init (Apple menu, making front process, etc)
- int flags = osgViewer::GraphicsWindowCocoa::WindowData::CheckForEvents;
+ if (poseAsStandaloneApp) {
+ flags |= osgViewer::GraphicsWindowCocoa::WindowData::PoseAsStandaloneApp;
+ }
traits->inheritedWindowData = new osgViewer::GraphicsWindowCocoa::WindowData(flags);
#endif
return 0;
}
}
+
+void WindowBuilder::setPoseAsStandaloneApp(bool b)
+{
+ poseAsStandaloneApp = b;
}
+
+} // of namespace flightgear
/** Get the name used to look up the default window.
*/
const std::string& getDefaultWindowName() { return defaultWindowName; }
+
+ static void setPoseAsStandaloneApp(bool b);
protected:
WindowBuilder(bool stencil);
static osg::GraphicsContext::Traits* makeDefaultTraits(bool stencil);
int defaultCounter;
static osg::ref_ptr<WindowBuilder> windowBuilder;
static const std::string defaultWindowName;
+ static bool poseAsStandaloneApp;
};
/** Silly function for making the default window and camera