From David Guthrie, "The cocoa version of the window for Mac OS X doesn't implement the requestWarpPointer function, but it turns out that the code from the Carbon version of the window is the same because it uses the windowing interface, so it this version, based on 2.8.3 GraphicsWindowCocoa, I copied the function over. The trunk version it also missing the function and the code looks to be very similar, so I assume it will transfer simply enough.

"
This commit is contained in:
Robert Osfield
2010-09-21 10:28:50 +00:00
parent 7e8ca5ccdf
commit 0d347352cf
2 changed files with 24 additions and 0 deletions

View File

@@ -126,6 +126,7 @@ class GraphicsWindowCocoa : public osgViewer::GraphicsWindow, public osgViewer::
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
virtual void setWindowName (const std::string & name);
virtual void requestWarpPointer(float x,float y);
virtual void useCursor(bool cursorOn);
virtual void setCursor(MouseCursor mouseCursor);

View File

@@ -1289,6 +1289,29 @@ void GraphicsWindowCocoa::setWindowName (const std::string & name)
[pool release];
}
// ----------------------------------------------------------------------------------------------------------
// requestWarpPointer
// ----------------------------------------------------------------------------------------------------------
void GraphicsWindowCocoa::requestWarpPointer(float x,float y)
{
DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(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 + _traits->x;
point.y = y + _traits->y;
CGDisplayMoveCursorToPoint(displayId, point);
getEventQueue()->mouseWarped(x,y);
}
// ----------------------------------------------------------------------------------------------------------
// useCursor