From Nguyen Van Truong, fix for passing of events to slaves

This commit is contained in:
Robert Osfield 2010-06-17 14:28:16 +00:00
parent 8fae9c5779
commit 776c03b9e3

View File

@ -408,6 +408,22 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
{ {
_events.clear(); _events.clear();
osgViewer::ViewerBase::Contexts contexts;
viewer.getContexts(contexts);
for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr)
{
osgGA::EventQueue::Events gw_events;
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(*citr);
if (gw)
{
gw->checkEvents();
gw->getEventQueue()->copyEvents(gw_events);
}
_events.insert(_events.end(), gw_events.begin(), gw_events.end());
}
viewer.getEventQueue()->copyEvents(_events); viewer.getEventQueue()->copyEvents(_events);
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl; osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;