diff --git a/include/osgProducer/KeyboardMouseCallback b/include/osgProducer/KeyboardMouseCallback index 387f2507d..a3d4ef076 100644 --- a/include/osgProducer/KeyboardMouseCallback +++ b/include/osgProducer/KeyboardMouseCallback @@ -46,17 +46,20 @@ class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseC virtual void mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm ); virtual void mouseMotion( float mx, float my); virtual void passiveMouseMotion( float mx, float my); + virtual void mouseWarp( float mx, float my); virtual void buttonPress( float mx, float my, unsigned int mbutton ); - virtual void doubleButtonPress( float mx, float my, unsigned int mbutton); + virtual void doubleButtonPress( float mx, float my, unsigned int mbutton); virtual void buttonRelease( float mx, float my, unsigned int mbutton ); virtual void keyPress( Producer::KeyCharacter key ); virtual void keyRelease( Producer::KeyCharacter key ); - virtual void specialKeyPress( Producer::KeyCharacter key); - virtual void specialKeyRelease( Producer::KeyCharacter key); + virtual void specialKeyPress( Producer::KeyCharacter key); + virtual void specialKeyRelease( Producer::KeyCharacter key); + virtual void windowConfig( int x, int y, unsigned int width, unsigned int height ); + virtual void shutdown(); @@ -67,7 +70,7 @@ class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseC // local methods and members typedef std::vector< osg::ref_ptr > EventQueue; - void getEventQueue(EventQueue& queue); + double getEventQueue(EventQueue& queue); bool done() { return _done; } float mx() { return _mx; } diff --git a/src/osgProducer/KeyboardMouseCallback.cpp b/src/osgProducer/KeyboardMouseCallback.cpp index d66063a18..2ba23e8ff 100644 --- a/src/osgProducer/KeyboardMouseCallback.cpp +++ b/src/osgProducer/KeyboardMouseCallback.cpp @@ -10,9 +10,9 @@ using namespace osgProducer; void KeyboardMouseCallback::mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm ) { osg::ref_ptr event = createEventAdapter(); - event->adaptMouseScroll(getTime(), sm); _eventQueueMutex.lock(); + event->adaptMouseScroll(getTime(), sm); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } @@ -24,9 +24,9 @@ void KeyboardMouseCallback::buttonPress( float mx, float my, unsigned int mbutto _mbutton |= (1<<(mbutton-1)); osg::ref_ptr event = createEventAdapter(); - event->adaptButtonPress(getTime(),mx,my,mbutton); _eventQueueMutex.lock(); + event->adaptButtonPress(getTime(),mx,my,mbutton); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } @@ -38,9 +38,9 @@ void KeyboardMouseCallback::buttonRelease( float mx, float my, unsigned int mbut _mbutton &= ~(1<<(mbutton-1)); osg::ref_ptr event = createEventAdapter(); - event->adaptButtonRelease(getTime(),mx,my,mbutton); _eventQueueMutex.lock(); + event->adaptButtonRelease(getTime(),mx,my,mbutton); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } @@ -52,64 +52,67 @@ void KeyboardMouseCallback::doubleButtonPress( float mx, float my, unsigned int _mbutton |= (1<<(mbutton-1)); osg::ref_ptr event = createEventAdapter(); - event->adaptButtonPress(getTime(),mx,my,mbutton); _eventQueueMutex.lock(); + event->adaptButtonPress(getTime(),mx,my,mbutton); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } void KeyboardMouseCallback::keyPress( Producer::KeyCharacter key ) { - osg::ref_ptr event = createEventAdapter(); + + _eventQueueMutex.lock(); event->adaptKeyPress(getTime(),key); + _eventQueue.push_back(event); + _eventQueueMutex.unlock(); // check against adapted key symbol. if (_escapeKeySetsDone && event->getKey()==osgGA::GUIEventAdapter::KEY_Escape) _done = true; - - - _eventQueueMutex.lock(); - _eventQueue.push_back(event); - _eventQueueMutex.unlock(); } void KeyboardMouseCallback::keyRelease( Producer::KeyCharacter key ) { - osg::ref_ptr event = createEventAdapter(); - event->adaptKeyRelease(getTime(),key); _eventQueueMutex.lock(); + event->adaptKeyRelease(getTime(),key); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } void KeyboardMouseCallback::specialKeyPress( Producer::KeyCharacter key ) { - - osg::ref_ptr event = createEventAdapter(); + + _eventQueueMutex.lock(); event->adaptKeyPress(getTime(),key); + _eventQueue.push_back(event); + _eventQueueMutex.unlock(); // check against adapted key symbol. if (_escapeKeySetsDone && event->getKey()==osgGA::GUIEventAdapter::KEY_Escape) _done = true; - - - _eventQueueMutex.lock(); - _eventQueue.push_back(event); - _eventQueueMutex.unlock(); } void KeyboardMouseCallback::specialKeyRelease( Producer::KeyCharacter key ) { - osg::ref_ptr event = createEventAdapter(); - event->adaptKeyRelease(getTime(),key); _eventQueueMutex.lock(); + event->adaptKeyRelease(getTime(),key); + _eventQueue.push_back(event); + _eventQueueMutex.unlock(); +} + +void KeyboardMouseCallback::windowConfig( int x, int y, unsigned int width, unsigned int height ) +{ + osg::ref_ptr event = createEventAdapter(); + + _eventQueueMutex.lock(); + event->adaptResize(getTime(), x, y, x+width, y+height ); _eventQueue.push_back(event); _eventQueueMutex.unlock(); } @@ -120,9 +123,9 @@ void KeyboardMouseCallback::mouseMotion( float mx, float my) _my = my; osg::ref_ptr event = createEventAdapter(); - event->adaptMouseMotion(getTime(),mx,my); _eventQueueMutex.lock(); + event->adaptMouseMotion(getTime(),mx,my); _eventQueue.push_back(event); _eventQueueMutex.unlock(); @@ -136,7 +139,20 @@ void KeyboardMouseCallback::passiveMouseMotion( float mx, float my) //std::cout << "mx="<