diff options
Diffstat (limited to 'backends/platform/android')
-rw-r--r-- | backends/platform/android/android.h | 1 | ||||
-rw-r--r-- | backends/platform/android/events.cpp | 25 |
2 files changed, 12 insertions, 14 deletions
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index b13b42e5bf..bd6f015a7f 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -119,6 +119,7 @@ private: public: virtual void pushEvent(const Common::Event &event); + virtual void pushKeyPressEvent(Common::Event &event); virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(bool skipRecord = false); virtual void delayMillis(uint msecs); diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 84a95ffa3c..da35fb0dd4 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -105,13 +105,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, } else { e.kbd.keycode = Common::KEYCODE_ESCAPE; e.kbd.ascii = Common::ASCII_ESCAPE; - - lockMutex(_event_queue_lock); - e.type = Common::EVENT_KEYDOWN; - _event_queue.push(e); - e.type = Common::EVENT_KEYUP; - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushKeyPressEvent(e); } return; @@ -120,13 +114,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (_swap_menu_and_back) { e.kbd.keycode = Common::KEYCODE_ESCAPE; e.kbd.ascii = Common::ASCII_ESCAPE; - - lockMutex(_event_queue_lock); - e.type = Common::EVENT_KEYDOWN; - _event_queue.push(e); - e.type = Common::EVENT_KEYUP; - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushKeyPressEvent(e); } else { e.type = Common::EVENT_MAINMENU; pushEvent(e); @@ -746,4 +734,13 @@ void OSystem_Android::pushEvent(const Common::Event &event) { unlockMutex(_event_queue_lock); } +void OSystem_Android::pushKeyPressEvent(Common::Event &event) { + lockMutex(_event_queue_lock); + event.type = Common::EVENT_KEYDOWN; + _event_queue.push(event); + event.type = Common::EVENT_KEYUP; + _event_queue.push(event); + unlockMutex(_event_queue_lock); +} + #endif |