Don't send too many useless events on touch move
This commit is contained in:
parent
51e1153cc9
commit
5af835505c
@ -453,6 +453,21 @@ s32 CIrrDeviceAndroid::handleInput(android_app* app, AInputEvent* androidEvent)
|
|||||||
event.TouchInput.X = AMotionEvent_getX(androidEvent, i + idx);
|
event.TouchInput.X = AMotionEvent_getX(androidEvent, i + idx);
|
||||||
event.TouchInput.Y = AMotionEvent_getY(androidEvent, i + idx);
|
event.TouchInput.Y = AMotionEvent_getY(androidEvent, i + idx);
|
||||||
|
|
||||||
|
if (event.TouchInput.ID >= 32)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TouchEventData& event_data = device->TouchEventsData[event.TouchInput.ID];
|
||||||
|
|
||||||
|
// Don't send move event when nothing changed
|
||||||
|
if (event_data.event == event.TouchInput.Event &&
|
||||||
|
event_data.x == event.TouchInput.X &&
|
||||||
|
event_data.y == event.TouchInput.Y)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
event_data.event = event.TouchInput.Event;
|
||||||
|
event_data.x = event.TouchInput.X;
|
||||||
|
event_data.y = event.TouchInput.Y;
|
||||||
|
|
||||||
device->postEventFromUser(event);
|
device->postEventFromUser(event);
|
||||||
|
|
||||||
if (event.TouchInput.ID == 0)
|
if (event.TouchInput.ID == 0)
|
||||||
|
@ -110,6 +110,16 @@ namespace irr
|
|||||||
static bool IsFocused;
|
static bool IsFocused;
|
||||||
static bool IsStarted;
|
static bool IsStarted;
|
||||||
|
|
||||||
|
struct TouchEventData
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
ETOUCH_INPUT_EVENT event;
|
||||||
|
|
||||||
|
TouchEventData() : x(0), y(0), event(ETIE_COUNT) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
TouchEventData TouchEventsData[32];
|
||||||
bool IsMousePressed;
|
bool IsMousePressed;
|
||||||
|
|
||||||
video::SExposedVideoData ExposedVideoData;
|
video::SExposedVideoData ExposedVideoData;
|
||||||
|
Loading…
Reference in New Issue
Block a user