Changeset 9120

Show
Ignore:
Timestamp:
11/07/08 11:23:57 (6 years ago)
Author:
robert
Message:

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"

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgViewer/api/Carbon/GraphicsWindowCarbon

    r8017 r9120  
    9393        virtual bool setWindowDecorationImplementation(bool flag); 
    9494 
     95        // Override from GUIActionAdapter 
     96        virtual void requestWarpPointer( float x, float y); 
     97 
    9598        /** Get focus.*/ 
    9699        virtual void grabFocus(); 
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCarbon.cpp

    r8398 r9120  
    12601260} 
    12611261 
     1262void GraphicsWindowCarbon::requestWarpPointer(float x,float y) 
     1263{ 
     1264 
     1265    OSXCarbonWindowingSystemInterface* wsi = dynamic_cast<OSXCarbonWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface()); 
     1266    if (wsi == NULL) { 
     1267        osg::notify(osg::WARN) << "GraphicsWindowCarbon::useCursor :: could not get OSXCarbonWindowingSystemInterface" << std::endl; 
     1268        return; 
     1269    } 
     1270 
     1271    CGDirectDisplayID displayId = wsi->getDisplayID((*_traits)); 
     1272 
     1273    CGPoint point; 
     1274    point.x = x; 
     1275    point.y = y; 
     1276    CGDisplayMoveCursorToPoint(displayId, point); 
     1277 
     1278    getEventQueue()->mouseWarped(x,y); 
     1279} 
    12621280 
    12631281