Permalink
Browse files

core: More proper handling of Joystick input events.

  • Loading branch information...
fzurita committed Dec 15, 2015
1 parent 2f79379 commit 5b3fbf11b74a684def58e4d79438ec5fb6d68ab5
@@ -53,7 +53,10 @@ public AxisMap( InputDevice device )
List<Integer> axisCodes = new ArrayList<Integer>();
for( MotionRange motionRange : motionRanges )
{
if( motionRange.getSource() == InputDevice.SOURCE_JOYSTICK )
boolean isJoystick = (motionRange.getSource() & InputDevice.SOURCE_JOYSTICK) ==
InputDevice.SOURCE_JOYSTICK;
if( isJoystick)
{
int axisCode = motionRange.getAxis();
int axisClass = detectClass( motionRange );
@@ -106,8 +106,11 @@ public boolean onGenericMotion( MotionEvent event )
@Override
public boolean onGenericMotion( View v, MotionEvent event )
{
boolean isJoystick = (event.getSource() & InputDevice.SOURCE_JOYSTICK) ==
InputDevice.SOURCE_JOYSTICK;
// Ignore motion events from non-joysticks (mice are a problem)
if( event.getSource() != InputDevice.SOURCE_JOYSTICK )
if(!isJoystick)
return false;
InputDevice device = event.getDevice();

0 comments on commit 5b3fbf1

Please sign in to comment.