Android: Accept touch events from "multiple" devices

Attempt to fix issue #953, although I can't really say whether this is
indeed some driver thing. All snippets I've found use exact comparison
only (usually switches).
This commit is contained in:
Mario Liebisch 2015-08-25 11:52:07 +02:00 committed by Lukas Dürrenberger
parent 1b2c50a0d8
commit 4f3c26660e

View File

@ -433,7 +433,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates* s
if (device == AINPUT_SOURCE_MOUSE)
event.type = Event::MouseMoved;
else if (device == AINPUT_SOURCE_TOUCHSCREEN)
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
event.type = Event::TouchMoved;
int pointerCount = AMotionEvent_getPointerCount(_event);
@ -452,7 +452,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates* s
states->mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y);
}
else if (device == AINPUT_SOURCE_TOUCHSCREEN)
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
{
if (states->touchEvents[id].x == x && states->touchEvents[id].y == y)
continue;
@ -496,7 +496,7 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
if (id >= 0 && id < Mouse::ButtonCount)
states->isButtonPressed[id] = true;
}
else if (device == AINPUT_SOURCE_TOUCHSCREEN)
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
{
event.type = Event::TouchBegan;
event.touch.finger = id;
@ -518,7 +518,7 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
if (id >= 0 && id < Mouse::ButtonCount)
states->isButtonPressed[id] = false;
}
else if (device == AINPUT_SOURCE_TOUCHSCREEN)
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
{
event.type = Event::TouchEnded;
event.touch.finger = id;