From ca69697ca67d0029db4ade2c73c10fd9bcbb29a3 Mon Sep 17 00:00:00 2001 From: frohlich Date: Wed, 23 May 2007 17:57:05 +0000 Subject: [PATCH] Quit the application on window close. --- src/Main/FGManipulator.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Main/FGManipulator.cxx b/src/Main/FGManipulator.cxx index 4b797e6ae..44c3dcae0 100644 --- a/src/Main/FGManipulator.cxx +++ b/src/Main/FGManipulator.cxx @@ -74,15 +74,11 @@ void eventToViewport(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us, int& x, int& y) { - osgViewer::Viewer* viewer = dynamic_cast(&us); - osg::Viewport* viewport = viewer->getCamera()->getViewport(); - const osg::GraphicsContext::Traits* traits - = viewer->getCamera()->getGraphicsContext()->getTraits(); x = (int)ea.getX(); y = (int)ea.getY(); if (ea.getMouseYOrientation() == osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS) - y = (int)traits->height - y; + y = (int)ea.getWindowHeight() - y; } } @@ -139,6 +135,10 @@ bool FGManipulator::handle(const osgGA::GUIEventAdapter& ea, if (windowResizeHandler) (*windowResizeHandler)(ea.getWindowWidth(), ea.getWindowHeight()); return true; + case osgGA::GUIEventAdapter::CLOSE_WINDOW: + case osgGA::GUIEventAdapter::QUIT_APPLICATION: + fgOSExit(0); + return true; default: return false; } -- 2.39.5