aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/iphone/osys_events.cpp22
-rw-r--r--backends/platform/iphone/osys_main.cpp6
-rw-r--r--backends/platform/iphone/osys_main.h2
3 files changed, 12 insertions, 18 deletions
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
index 38e101307a..6e2a4b7e1e 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -28,6 +28,7 @@
#include "osys_main.h"
+static const int kQueuedInputEventDelay = 50;
bool OSystem_IPHONE::pollEvent(Common::Event &event) {
//printf("pollEvent()\n");
@@ -39,14 +40,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {
_timerCallbackNext = curTime + _timerCallbackTimer;
}
- if (_needEventRestPeriod) {
- // Workaround: Some engines can't handle mouse-down and mouse-up events
- // appearing right after each other, without a call returning no input in between.
- _needEventRestPeriod = false;
- return false;
- }
-
- if (_queuedInputEvent.type != (Common::EventType)0) {
+ if (_queuedInputEvent.type != (Common::EventType)0 && curTime >= _queuedEventTime) {
event = _queuedInputEvent;
_queuedInputEvent.type = (Common::EventType)0;
return true;
@@ -191,7 +185,7 @@ bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
_queuedInputEvent.mouse.x = _mouseX;
_queuedInputEvent.mouse.y = _mouseY;
_lastMouseTap = getMillis();
- _needEventRestPeriod = true;
+ _queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
} else
return false;
}
@@ -232,7 +226,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE;
- _needEventRestPeriod = true;
+ _queuedEventTime = curTime + kQueuedInputEventDelay;
_lastSecondaryTap = 0;
} else if (!_mouseClickAndDragEnabled) {
//printf("Rightclick!\n");
@@ -243,7 +237,7 @@ bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int
_queuedInputEvent.mouse.x = _mouseX;
_queuedInputEvent.mouse.y = _mouseY;
_lastSecondaryTap = curTime;
- _needEventRestPeriod = true;
+ _queuedEventTime = curTime + kQueuedInputEventDelay;
} else {
//printf("Right nothing!\n");
return false;
@@ -331,7 +325,7 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x,
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5;
- _needEventRestPeriod = true;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
return true;
}
@@ -460,7 +454,7 @@ void OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPresse
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed;
event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii;
- _needEventRestPeriod = true;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
}
bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
@@ -527,7 +521,7 @@ bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
event.type = Common::EVENT_KEYDOWN;
_queuedInputEvent.type = Common::EVENT_KEYUP;
event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
- _needEventRestPeriod = true;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
return true;
}
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index dcca8dcbef..12317ad935 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -55,9 +55,9 @@ void *OSystem_IPHONE::s_soundParam = NULL;
OSystem_IPHONE::OSystem_IPHONE() :
_savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL),
_overlayVisible(false), _fullscreen(NULL),
- _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0),
- _secondaryTapped(false), _lastSecondaryTap(0), _screenOrientation(kScreenOrientationFlippedLandscape),
- _needEventRestPeriod(false), _mouseClickAndDragEnabled(false),
+ _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
+ _secondaryTapped(false), _lastSecondaryTap(0),
+ _screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
_overlayHeight(0), _overlayWidth(0), _overlayBuffer(0)
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index be3ae4b48a..1ff87967a1 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -86,9 +86,9 @@ protected:
bool _mouseDirty;
long _lastMouseDown;
long _lastMouseTap;
+ long _queuedEventTime;
Common::Rect _lastDrawnMouseRect;
Common::Event _queuedInputEvent;
- bool _needEventRestPeriod;
bool _secondaryTapped;
long _lastSecondaryDown;
long _lastSecondaryTap;