diff options
author | dhewg | 2011-04-06 18:08:38 +0200 |
---|---|---|
committer | dhewg | 2011-04-06 18:27:15 +0200 |
commit | a565e63c48b2bb55b9e1197addddd3c03cf85c48 (patch) | |
tree | ee64fe4f2e466d40b2e0d885dd7ed08a7b781d03 /backends/platform/android/events.cpp | |
parent | b45640c47b97c36442d01c35e73b4cae9ad5648e (diff) | |
download | scummvm-rg350-a565e63c48b2bb55b9e1197addddd3c03cf85c48.tar.gz scummvm-rg350-a565e63c48b2bb55b9e1197addddd3c03cf85c48.tar.bz2 scummvm-rg350-a565e63c48b2bb55b9e1197addddd3c03cf85c48.zip |
ANDROID: Add multitouch support
Diffstat (limited to 'backends/platform/android/events.cpp')
-rw-r--r-- | backends/platform/android/events.cpp | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index ed825dbc9c..09466b4d2f 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -43,7 +43,8 @@ enum { JE_SCROLL = 4, JE_TAP = 5, JE_DOUBLE_TAP = 6, - JE_BALL = 7, + JE_MULTI = 7, + JE_BALL = 8, JE_QUIT = 0x1000 }; @@ -51,7 +52,9 @@ enum { enum { JACTION_DOWN = 0, JACTION_UP = 1, - JACTION_MULTIPLE = 2 + JACTION_MULTIPLE = 2, + JACTION_POINTER_DOWN = 5, + JACTION_POINTER_UP = 6 }; // system keys @@ -549,6 +552,11 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; case JE_TAP: + if (_fingersDown > 0) { + _fingersDown = 0; + return; + } + e.type = Common::EVENT_MOUSEMOVE; if (_touchpad_mode) { @@ -643,6 +651,54 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; + case JE_MULTI: + switch (arg2) { + case JACTION_POINTER_DOWN: + if (arg1 > _fingersDown) + _fingersDown = arg1; + + return; + + case JACTION_POINTER_UP: + if (arg1 != _fingersDown) + return; + + { + Common::EventType up; + + switch (_fingersDown) { + case 1: + e.type = Common::EVENT_RBUTTONDOWN; + up = Common::EVENT_RBUTTONUP; + break; + case 2: + e.type = Common::EVENT_MBUTTONDOWN; + up = Common::EVENT_MBUTTONUP; + break; + default: + LOGD("unmapped multi tap: %d", _fingersDown); + return; + } + + e.mouse = getEventManager()->getMousePos(); + + lockMutex(_event_queue_lock); + + _event_queue.push(e); + e.type = up; + _event_queue.push(e); + + unlockMutex(_event_queue_lock); + return; + + default: + LOGE("unhandled jaction on multi tap: %d", arg2); + return; + } + } + + return; + case JE_BALL: e.mouse = getEventManager()->getMousePos(); |