From Stephan Huber,
"attached you'll find some modifications to Producer, osgGA and osgProducer to enable Mac OS X support for + scrollwheels, + mightymouse-srollballs + new tracking-pads with scroll feature + tablet-support (pressure, proximity and pointertype) (Wacom only tested) I think there was a bug in the windows-implementation of scroll-wheel support (wrong order of ScrollingMotion-enum, casting problem) which is fixed now. The scrollwheel-code is a bit klunky across platforms, some devices on OS X can report an absolute delta in pixel-coordinates not only the direction, so for now there is scrollingMotion (which describes the direction) and scrolldeltax and scrolldeltay. I decided to leave the scrollingmotion-stuff to not break old code relying on this."
This commit is contained in:
@@ -87,6 +87,24 @@ void EventQueue::windowResize(float Xmin, float Ymin, float Xmax, float Ymax)
|
||||
addEvent(event);
|
||||
}
|
||||
|
||||
void EventQueue::penPressure(float pressure)
|
||||
{
|
||||
GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
|
||||
event->setEventType(GUIEventAdapter::PEN_PRESSURE);
|
||||
event->setPenPressure(pressure);
|
||||
|
||||
addEvent(event);
|
||||
}
|
||||
|
||||
void EventQueue::penProximity(GUIEventAdapter::TabletPointerType pt, bool isEntering)
|
||||
{
|
||||
GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
|
||||
event->setEventType( (isEntering) ? GUIEventAdapter::PEN_PROXIMITY_ENTER : GUIEventAdapter::PEN_PROXIMITY_LEAVE);
|
||||
event->setTabletPointerType(pt);
|
||||
|
||||
addEvent(event);
|
||||
}
|
||||
|
||||
void EventQueue::mouseScroll(GUIEventAdapter::ScrollingMotion sm)
|
||||
{
|
||||
GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
|
||||
@@ -96,6 +114,16 @@ void EventQueue::mouseScroll(GUIEventAdapter::ScrollingMotion sm)
|
||||
addEvent(event);
|
||||
}
|
||||
|
||||
void EventQueue::mouseScroll2D(float x, float y)
|
||||
{
|
||||
GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
|
||||
event->setEventType(GUIEventAdapter::SCROLL);
|
||||
event->setScrollingMotionDelta(x,y);
|
||||
|
||||
addEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void EventQueue::mouseWarp(float x, float y)
|
||||
{
|
||||
_accumulateEventState->setX(x);
|
||||
|
||||
@@ -26,10 +26,14 @@ GUIEventAdapter::GUIEventAdapter():
|
||||
_Ymax(1.0),
|
||||
_mx(0.5),
|
||||
_my(0.5),
|
||||
_pressure(0.0),
|
||||
_buttonMask(0),
|
||||
_modKeyMask(0),
|
||||
_scrollingMotion(SCROLL_DOWN),
|
||||
_mouseYOrientation(Y_INCREASING_DOWNWARDS)
|
||||
_scrollingMotion(SCROLL_NONE),
|
||||
_scrollingDeltaX(0),
|
||||
_scrollingDeltaY(0),
|
||||
_mouseYOrientation(Y_INCREASING_DOWNWARDS),
|
||||
_tabletPointerType(UNKNOWN)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs):
|
||||
@@ -44,10 +48,14 @@ GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs):
|
||||
_Ymax(rhs._Ymax),
|
||||
_mx(rhs._mx),
|
||||
_my(rhs._my),
|
||||
_pressure(rhs._pressure),
|
||||
_buttonMask(rhs._buttonMask),
|
||||
_modKeyMask(rhs._modKeyMask),
|
||||
_scrollingMotion(rhs._scrollingMotion),
|
||||
_mouseYOrientation(rhs._mouseYOrientation)
|
||||
_scrollingDeltaX(rhs._scrollingDeltaX),
|
||||
_scrollingDeltaY(rhs._scrollingDeltaY),
|
||||
_mouseYOrientation(rhs._mouseYOrientation),
|
||||
_tabletPointerType(rhs._tabletPointerType)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::~GUIEventAdapter()
|
||||
|
||||
@@ -25,12 +25,33 @@ void KeyboardMouseCallback::mouseScroll( Producer::KeyboardMouseCallback::Scroll
|
||||
switch(sm)
|
||||
{
|
||||
case(Producer::KeyboardMouseCallback::ScrollNone): break;
|
||||
case(Producer::KeyboardMouseCallback::ScrollLeft): _eventQueue->mouseScroll(osgGA::GUIEventAdapter::SCROLL_LEFT); break;
|
||||
case(Producer::KeyboardMouseCallback::ScrollRight): _eventQueue->mouseScroll(osgGA::GUIEventAdapter::SCROLL_RIGHT); break;
|
||||
case(Producer::KeyboardMouseCallback::ScrollUp): _eventQueue->mouseScroll(osgGA::GUIEventAdapter::SCROLL_UP); break;
|
||||
case(Producer::KeyboardMouseCallback::ScrollDown): _eventQueue->mouseScroll(osgGA::GUIEventAdapter::SCROLL_DOWN); break;
|
||||
case(Producer::KeyboardMouseCallback::Scroll2D): _eventQueue->mouseScroll(osgGA::GUIEventAdapter::SCROLL_2D); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::mouseScroll2D( float x, float y )
|
||||
{
|
||||
updateWindowSize();
|
||||
if (_eventQueue.valid()) _eventQueue->mouseScroll2D(x,y);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::penPressure( float pressure )
|
||||
{
|
||||
updateWindowSize();
|
||||
if (_eventQueue.valid()) _eventQueue->penPressure(pressure);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::penProximity(TabletPointerType pt, bool isEntering)
|
||||
{
|
||||
updateWindowSize();
|
||||
if (_eventQueue.valid()) _eventQueue->penProximity((osgGA::GUIEventAdapter::TabletPointerType)pt, isEntering);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::buttonPress( float mx, float my, unsigned int mbutton )
|
||||
{
|
||||
updateWindowSize();
|
||||
|
||||
Reference in New Issue
Block a user