Skip to content

Commit

Permalink
Added reset of the event windowSize
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Jul 19, 2006
1 parent b03a772 commit 11e2257
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/osgProducer/KeyboardMouseCallback.cpp
Expand Up @@ -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("<<minX<<","<<minY<<","<<maxX<<","<<maxY<<")"<<std::endl;

ea->setWindowSize(minX,minY,maxX,maxY);
}
else if (rs)
Expand All @@ -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("<<minX<<","<<minY<<","<<maxX<<","<<maxY<<")"<<std::endl;

ea->setWindowSize(minX,minY,maxX,maxY);
}
}
Expand Down
17 changes: 12 additions & 5 deletions src/osgProducer/Viewer.cpp
Expand Up @@ -531,8 +531,17 @@ bool Viewer::realize()
if (_kbm.valid() && !_kbm->isRunning())
{
_kbm->startThread();

while (!_kbm->isRunning())
{
// osg::notify(osg::NOTICE)<<"Waiting"<<std::endl;
OpenThreads::Thread::YieldCurrentThread();
}
}
#endif

if (_kbmcb.valid()) _kbmcb->updateWindowSize();

// by default set up the DatabasePager.
{
osgDB::DatabasePager* databasePager = osgDB::Registry::instance()->getOrCreateDatabasePager();
Expand Down Expand Up @@ -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<osgGA::GUIEventAdapter> init_event = new osgGA::GUIEventAdapter;
init_event->setEventType(osgGA::GUIEventAdapter::FRAME);
init_event->setTime(0.0);

osg::ref_ptr<osgGA::GUIEventAdapter> init_event = _eventQueue->createEvent();

_keyswitchManipulator->setNode(getTopMostSceneData());
_keyswitchManipulator->home(*init_event,*this);
}
Expand Down

0 comments on commit 11e2257

Please sign in to comment.