diff options
author | Alyssa Milburn | 2012-02-03 12:36:03 +0100 |
---|---|---|
committer | Alyssa Milburn | 2012-02-03 12:36:03 +0100 |
commit | 4763b2c51b4c73dae4340993fc9b71200bcdbe28 (patch) | |
tree | c2b8942d7d492a867a17342f7005e4b82d9ed8a0 /backends/platform/android/events.cpp | |
parent | a488556dcdfb69ec30af740aa2c71977f505ef35 (diff) | |
download | scummvm-rg350-4763b2c51b4c73dae4340993fc9b71200bcdbe28.tar.gz scummvm-rg350-4763b2c51b4c73dae4340993fc9b71200bcdbe28.tar.bz2 scummvm-rg350-4763b2c51b4c73dae4340993fc9b71200bcdbe28.zip |
ANDROID: Add faked input delay.
This adds an artificial delay for mouse up events to make engines
like Gob work, similar to the iPhone fix in b3062b5e.
Diffstat (limited to 'backends/platform/android/events.cpp')
-rw-r--r-- | backends/platform/android/events.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index e73e689e3b..b46c144344 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -216,6 +216,8 @@ static inline T scalef(T in, float numerator, float denominator) { return static_cast<float>(in) * numerator / denominator; } +static const int kQueuedInputEventDelay = 50; + void OSystem_Android::setupKeymapper() { #ifdef ENABLE_KEYMAPPER using namespace Common; @@ -601,13 +603,18 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, lockMutex(_event_queue_lock); + if (_queuedEventTime) + _event_queue.push(_queuedEvent); + if (!_touchpad_mode) _event_queue.push(e); e.type = down; _event_queue.push(e); + e.type = up; - _event_queue.push(e); + _queuedEvent = e; + _queuedEventTime = getMillis() + kQueuedInputEventDelay; unlockMutex(_event_queue_lock); } @@ -702,9 +709,14 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, lockMutex(_event_queue_lock); + if (_queuedEventTime) + _event_queue.push(_queuedEvent); + _event_queue.push(e); + e.type = up; - _event_queue.push(e); + _queuedEvent = e; + _queuedEventTime = getMillis() + kQueuedInputEventDelay; unlockMutex(_event_queue_lock); return; @@ -800,6 +812,13 @@ bool OSystem_Android::pollEvent(Common::Event &event) { lockMutex(_event_queue_lock); + if (_queuedEventTime && (getMillis() > _queuedEventTime)) { + event = _queuedEvent; + _queuedEventTime = 0; + unlockMutex(_event_queue_lock); + return true; + } + if (_event_queue.empty()) { unlockMutex(_event_queue_lock); return false; |