From Martins Innus, "Here is a fix to add requestWarpPointer for OS X. It seems to work for me, I just took what osgProducer had. These are updated files to 2.7.3"

This commit is contained in:
Robert Osfield
2008-11-07 10:23:57 +00:00
parent 20eba3fb74
commit 4f5379389d
2 changed files with 21 additions and 0 deletions

View File

@@ -92,6 +92,9 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
/** Set Window decoration.*/
virtual bool setWindowDecorationImplementation(bool flag);
// Override from GUIActionAdapter
virtual void requestWarpPointer( float x, float y);
/** Get focus.*/
virtual void grabFocus();

View File

@@ -1259,6 +1259,24 @@ void GraphicsWindowCarbon::setWindowName (const std::string& name)
}
}
void GraphicsWindowCarbon::requestWarpPointer(float x,float y)
{
OSXCarbonWindowingSystemInterface* wsi = dynamic_cast<OSXCarbonWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
if (wsi == NULL) {
osg::notify(osg::WARN) << "GraphicsWindowCarbon::useCursor :: could not get OSXCarbonWindowingSystemInterface" << std::endl;
return;
}
CGDirectDisplayID displayId = wsi->getDisplayID((*_traits));
CGPoint point;
point.x = x;
point.y = y;
CGDisplayMoveCursorToPoint(displayId, point);
getEventQueue()->mouseWarped(x,y);
}
void GraphicsWindowCarbon::transformMouseXY(float& x, float& y)