diff options
author | Cameron Cawley | 2019-04-12 21:42:54 +0100 |
---|---|---|
committer | Cameron Cawley | 2019-04-12 21:42:54 +0100 |
commit | 2af325f60adce92528405cee61c3f4aca447c292 (patch) | |
tree | f92e5119d26f612f2f7658ae7a668270c301666c /backends/platform/android/events.cpp | |
parent | d75a1355ba38831c89cff2a34ffa47c1cdcf572b (diff) | |
download | scummvm-rg350-2af325f60adce92528405cee61c3f4aca447c292.tar.gz scummvm-rg350-2af325f60adce92528405cee61c3f4aca447c292.tar.bz2 scummvm-rg350-2af325f60adce92528405cee61c3f4aca447c292.zip |
ANDROID: Factor event pushing into pushEvent
Originally from ResidualVM.
Diffstat (limited to 'backends/platform/android/events.cpp')
-rw-r--r-- | backends/platform/android/events.cpp | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index a9cc556b9a..9020bfd96e 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -87,9 +87,7 @@ void OSystem_Android::warpMouse(int x, int y) { clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); } void OSystem_Android::clipMouse(Common::Point &p) { @@ -179,9 +177,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, case JKEYCODE_MENU: e.type = Common::EVENT_MAINMENU; - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -191,9 +187,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (arg1 == JACTION_DOWN) { e.type = Common::EVENT_MAINMENU; - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); } return; @@ -207,9 +201,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, e.mouse = getEventManager()->getMousePos(); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -317,9 +309,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, if (arg4 & (JMETA_SYM | JMETA_CTRL)) e.kbd.flags |= Common::KBD_CTRL; - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -360,9 +350,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -381,9 +369,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, e.mouse = getEventManager()->getMousePos(); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; } @@ -413,9 +399,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, clipMouse(e.mouse); } - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -602,9 +586,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; } - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -614,9 +596,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, scaleMouse(e.mouse, arg1, arg2); clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -626,9 +606,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, scaleMouse(e.mouse, arg1, arg2); clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -638,9 +616,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, scaleMouse(e.mouse, arg1, arg2); clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -650,9 +626,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, scaleMouse(e.mouse, arg1, arg2); clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -662,9 +636,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, scaleMouse(e.mouse, arg1, arg2); clipMouse(e.mouse); - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -715,9 +687,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; } - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); break; @@ -740,18 +710,14 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, return; } - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; case JE_MMB_DOWN: e.type = Common::EVENT_MAINMENU; - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -763,9 +729,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, case JE_QUIT: e.type = Common::EVENT_QUIT; - lockMutex(_event_queue_lock); - _event_queue.push(e); - unlockMutex(_event_queue_lock); + pushEvent(e); return; @@ -838,4 +802,10 @@ bool OSystem_Android::pollEvent(Common::Event &event) { return true; } +void OSystem_Android::pushEvent(const Common::Event &event) { + lockMutex(_event_queue_lock); + _event_queue.push(event); + unlockMutex(_event_queue_lock); +} + #endif |