Improved the handling of setStartTick() being called mid app, such as when idirectly called when doing a Viewer::setSceneData().
Improved the setting the the initial event state.
This commit is contained in:
parent
0329ca5cea
commit
e8bae33143
@ -645,6 +645,19 @@ void CompositeViewer::advance(double simulationTime)
|
||||
++vitr)
|
||||
{
|
||||
View* view = vitr->get();
|
||||
|
||||
osgGA::GUIEventAdapter* eventState = view->getEventQueue()->getCurrentEventState();
|
||||
if (view->getCamera()->getViewport())
|
||||
{
|
||||
osg::Viewport* viewport = view->getCamera()->getViewport();
|
||||
eventState->setInputRange( viewport->x(), viewport->y(), viewport->x() + viewport->width(), viewport->y() + viewport->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
eventState->setInputRange(-1.0, -1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
view->getEventQueue()->frame( getFrameStamp()->getReferenceTime() );
|
||||
}
|
||||
|
||||
|
@ -1200,6 +1200,8 @@ void GraphicsWindowX11::checkEvents()
|
||||
double eventTime = baseTime;
|
||||
double resizeTime = eventTime;
|
||||
_timeOfLastCheckEvents = getEventQueue()->getTime();
|
||||
if (baseTime>_timeOfLastCheckEvents) baseTime = _timeOfLastCheckEvents;
|
||||
|
||||
|
||||
// OSG_NOTICE<<"GraphicsWindowX11::checkEvents() : getEventQueue()->getCurrentEventState()->getGraphicsContext()="<<getEventQueue()->getCurrentEventState()->getGraphicsContext()<<std::endl;
|
||||
|
||||
|
@ -562,6 +562,16 @@ void Viewer::realize()
|
||||
}
|
||||
}
|
||||
|
||||
osgGA::GUIEventAdapter* eventState = getEventQueue()->getCurrentEventState();
|
||||
if (getCamera()->getViewport())
|
||||
{
|
||||
osg::Viewport* viewport = getCamera()->getViewport();
|
||||
eventState->setInputRange( viewport->x(), viewport->y(), viewport->x() + viewport->width(), viewport->y() + viewport->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
eventState->setInputRange(-1.0, -1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -588,6 +598,17 @@ void Viewer::advance(double simulationTime)
|
||||
|
||||
if (_eventQueue.valid())
|
||||
{
|
||||
osgGA::GUIEventAdapter* eventState = getEventQueue()->getCurrentEventState();
|
||||
if (getCamera()->getViewport())
|
||||
{
|
||||
osg::Viewport* viewport = getCamera()->getViewport();
|
||||
eventState->setInputRange( viewport->x(), viewport->y(), viewport->x() + viewport->width(), viewport->y() + viewport->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
eventState->setInputRange(-1.0, -1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
_eventQueue->frame( getFrameStamp()->getReferenceTime() );
|
||||
}
|
||||
|
||||
@ -637,11 +658,6 @@ void Viewer::eventTraversal()
|
||||
{
|
||||
osg::Viewport* viewport = getCamera()->getViewport();
|
||||
masterCameraVPW *= viewport->computeWindowMatrix();
|
||||
eventState->setInputRange( viewport->x(), viewport->y(), viewport->x() + viewport->width(), viewport->y() + viewport->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
eventState->setInputRange(-1.0, -1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user