From 11e22579d62d4ca6de666129bbaeac9ff370ef84 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 19 Jul 2006 14:04:16 +0000 Subject: [PATCH] Added reset of the event windowSize --- src/osgProducer/KeyboardMouseCallback.cpp | 5 +++++ src/osgProducer/Viewer.cpp | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/osgProducer/KeyboardMouseCallback.cpp b/src/osgProducer/KeyboardMouseCallback.cpp index 1b14a0d6b..9e07ae973 100644 --- a/src/osgProducer/KeyboardMouseCallback.cpp +++ b/src/osgProducer/KeyboardMouseCallback.cpp @@ -157,6 +157,9 @@ void KeyboardMouseCallback::updateWindowSize() maxY = osg::maximum(maxY,ir.bottom()); maxY = osg::maximum(maxY,ir.bottom()+ir.height()); } + + // osg::notify(osg::NOTICE)<<"IA ea->setWindowSize("<setWindowSize(minX,minY,maxX,maxY); } else if (rs) @@ -170,6 +173,8 @@ void KeyboardMouseCallback::updateWindowSize() float minY = osg::minimum(ir.bottom(),ir.bottom()+ir.height()); float maxY = osg::maximum(ir.bottom(),ir.bottom()+ir.height()); + // osg::notify(osg::NOTICE)<<"RS ea->setWindowSize("<setWindowSize(minX,minY,maxX,maxY); } } diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index bf493c4c5..58699dd09 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -531,8 +531,17 @@ bool Viewer::realize() if (_kbm.valid() && !_kbm->isRunning()) { _kbm->startThread(); + + while (!_kbm->isRunning()) + { + // osg::notify(osg::NOTICE)<<"Waiting"<updateWindowSize(); + // by default set up the DatabasePager. { osgDB::DatabasePager* databasePager = osgDB::Registry::instance()->getOrCreateDatabasePager(); @@ -560,14 +569,12 @@ bool Viewer::realize() } - if (_keyswitchManipulator.valid() && _keyswitchManipulator->getCurrentMatrixManipulator()) + if (_keyswitchManipulator.valid() && _keyswitchManipulator->getCurrentMatrixManipulator() && _eventQueue.valid()) { _keyswitchManipulator->setCoordinateFrameCallback(new ViewerCoordinateFrameCallback(this)); - osg::ref_ptr init_event = new osgGA::GUIEventAdapter; - init_event->setEventType(osgGA::GUIEventAdapter::FRAME); - init_event->setTime(0.0); - + osg::ref_ptr init_event = _eventQueue->createEvent(); + _keyswitchManipulator->setNode(getTopMostSceneData()); _keyswitchManipulator->home(*init_event,*this); }