Improved the handling of moving the mouse pointer across screens, and add

grab focus support that honours where the mouse pointer was originally.
This commit is contained in:
Robert Osfield
2006-12-21 11:20:42 +00:00
parent 21de9e4acc
commit 7772da71eb
3 changed files with 101 additions and 12 deletions

View File

@@ -70,6 +70,29 @@ void Viewer::realize()
slave._camera->getGraphicsContext()->realize();
}
}
bool grabFocus = true;
if (grabFocus)
{
if (_camera.valid() && _camera->getGraphicsContext())
{
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
gw->grabFocusIfPointerInWindow();
}
for(unsigned int i=0; i<getNumSlaves(); ++i)
{
Slave& slave = getSlave(i);
if (slave._camera.valid() && slave._camera->getGraphicsContext())
{
osg::notify(osg::NOTICE)<<" slave realize()"<<std::endl;
slave._camera->getGraphicsContext()->realize();
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(slave._camera->getGraphicsContext());
gw->grabFocusIfPointerInWindow();
}
}
}
}