aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/android.h1
-rw-r--r--backends/platform/android/events.cpp78
2 files changed, 25 insertions, 54 deletions
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 61715daeb4..3b33247be1 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -265,6 +265,7 @@ public:
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
+ virtual void pushEvent(const 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 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