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:
@@ -56,6 +56,15 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
|
||||
|
||||
/** method for adapting mouse scroll wheel events, placing this event on the back of the event queue. */
|
||||
void mouseScroll(GUIEventAdapter::ScrollingMotion sm);
|
||||
|
||||
/** method for adapting mouse scroll wheel events, placing this event on the back of the event queue. */
|
||||
void mouseScroll2D(float x, float y);
|
||||
|
||||
/** method for adapting pen pressure events, placing this event on the back og the event queue.*/
|
||||
void penPressure(float pressure);
|
||||
|
||||
/** method for adapting pen proximity events, placing this event on the back og the event queue.*/
|
||||
void penProximity(GUIEventAdapter::TabletPointerType pt, bool isEntering);
|
||||
|
||||
/** method for updating in response to a mouse warp. Note, just moves the mouse position without creating a new event for it.*/
|
||||
void mouseWarp(float x, float y);
|
||||
|
||||
@@ -50,7 +50,10 @@ public:
|
||||
KEYUP,
|
||||
FRAME,
|
||||
RESIZE,
|
||||
SCROLL
|
||||
SCROLL,
|
||||
PEN_PRESSURE,
|
||||
PEN_PROXIMITY_ENTER,
|
||||
PEN_PROXIMITY_LEAVE
|
||||
};
|
||||
|
||||
enum KeySymbol
|
||||
@@ -231,12 +234,22 @@ public:
|
||||
|
||||
enum ScrollingMotion
|
||||
{
|
||||
SCROLL_NONE,
|
||||
SCROLL_LEFT,
|
||||
SCROLL_RIGHT,
|
||||
SCROLL_UP,
|
||||
SCROLL_DOWN
|
||||
SCROLL_DOWN,
|
||||
SCROLL_2D
|
||||
};
|
||||
|
||||
enum TabletPointerType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
PEN,
|
||||
PUCK,
|
||||
ERASER
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
GUIEventAdapter();
|
||||
@@ -319,9 +332,30 @@ public:
|
||||
|
||||
unsigned int getModKeyMask() const { return _modKeyMask; }
|
||||
|
||||
|
||||
/// get the pressure, from a tablet input device (range 0 - 1)
|
||||
float getPenPressure() const { return _pressure; }
|
||||
/// sets the pressure from a tablet
|
||||
void setPenPressure(float pressure) { _pressure = pressure; }
|
||||
/// get the current used tablet pointer type
|
||||
TabletPointerType getTabletPointerType() const { return _tabletPointerType; }
|
||||
/// set the current used tablet pointer type
|
||||
void setTabletPointerType(TabletPointerType pt) { _tabletPointerType = pt; }
|
||||
|
||||
void setScrollingMotion(ScrollingMotion motion) { _scrollingMotion = motion; }
|
||||
|
||||
|
||||
/** get the scrolling x-delta */
|
||||
float getScrollingDeltaX() const { return _scrollingDeltaX; }
|
||||
|
||||
/** get the scrolling y-delta */
|
||||
float getScrollingDeltaY() const { return _scrollingDeltaY; }
|
||||
|
||||
/** sets the scrolling delta to x,y and the type of scrolling to SCROLL_2D */
|
||||
void setScrollingMotionDelta(float x, float y) {
|
||||
_scrollingMotion = SCROLL_2D;
|
||||
_scrollingDeltaX = x;
|
||||
_scrollingDeltaY = y;
|
||||
}
|
||||
|
||||
ScrollingMotion getScrollingMotion() const { return _scrollingMotion; }
|
||||
|
||||
|
||||
@@ -360,10 +394,13 @@ public:
|
||||
float _Ymin,_Ymax;
|
||||
float _mx;
|
||||
float _my;
|
||||
float _pressure;
|
||||
unsigned int _buttonMask;
|
||||
unsigned int _modKeyMask;
|
||||
ScrollingMotion _scrollingMotion;
|
||||
float _scrollingDeltaX, _scrollingDeltaY;
|
||||
MouseYOrientation _mouseYOrientation;
|
||||
TabletPointerType _tabletPointerType;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseC
|
||||
|
||||
// override KeyboardMouseCallback methods.
|
||||
virtual void mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm );
|
||||
virtual void mouseScroll2D( float, float);
|
||||
virtual void penPressure(float pressure);
|
||||
virtual void penProximity(TabletPointerType, bool);
|
||||
virtual void mouseMotion( float mx, float my);
|
||||
virtual void passiveMouseMotion( float mx, float my);
|
||||
virtual void mouseWarp( float mx, float my);
|
||||
|
||||
Reference in New Issue
Block a user