From b23dfd72f123c7d98c5076d813e522834888588a Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sat, 14 May 2011 23:01:08 -0400 Subject: IPHONE: Changed the iOS queued event handling to fix mouseclicks in Gob We now delay the mouseup events for 50ms, rather than just delaying them for an additional couple of pollEvent (which doesn't work anymore due to changes in the eventhandling code elsewhere). This fixes #3018512. --- backends/platform/iphone/osys_events.cpp | 22 ++++++++-------------- backends/platform/iphone/osys_main.cpp | 6 +++--- backends/platform/iphone/osys_main.h | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) (limited to 'backends') diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp index c30e34dd05..965334873e 100644 --- a/backends/platform/iphone/osys_events.cpp +++ b/backends/platform/iphone/osys_events.cpp @@ -31,6 +31,7 @@ #include "osys_main.h" +static const int kQueuedInputEventDelay = 50; bool OSystem_IPHONE::pollEvent(Common::Event &event) { //printf("pollEvent()\n"); @@ -42,14 +43,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; @@ -194,7 +188,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; } @@ -235,7 +229,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"); @@ -246,7 +240,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; @@ -334,7 +328,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; } @@ -463,7 +457,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) { @@ -530,7 +524,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 813adfbc43..d14d44caca 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -58,9 +58,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 79f596632f..077cb51c1c 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -89,9 +89,9 @@ protected: bool _mouseDirty; long _lastMouseDown; long _lastMouseTap; + long _queuedEventTime; Common::Rect _lastDrawnMouseRect; Common::Event _queuedInputEvent; - bool _needEventRestPeriod; bool _secondaryTapped; long _lastSecondaryDown; long _lastSecondaryTap; -- cgit v1.2.3 From 136d687dd30b4721127ae359837c8470c95306ec Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 16 May 2011 00:31:53 +0200 Subject: VKEYBD: Update vkeybd_default.zip Specifically, in vkeybd_default.xml, 'centre' changed to 'center'. (cherry picked from commit db068cf8588a2058d49ae5af3d5d247a3353ef8c) --- backends/vkeybd/packs/vkeybd_default.zip | Bin 184936 -> 179277 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'backends') diff --git a/backends/vkeybd/packs/vkeybd_default.zip b/backends/vkeybd/packs/vkeybd_default.zip index 94c4649768..960e943152 100644 Binary files a/backends/vkeybd/packs/vkeybd_default.zip and b/backends/vkeybd/packs/vkeybd_default.zip differ -- cgit v1.2.3 From a1f02c3f32fb0d6189bdc83aedfe597281afe9cd Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sun, 15 May 2011 21:43:27 -0400 Subject: IPHONE: Fixed mouse position when the overlay is visible --- backends/platform/iphone/iphone_video.m | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 821d3de634..4fdb820f70 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -178,13 +178,18 @@ const char* iPhone_getDocumentsDir() { } bool getLocalMouseCoords(CGPoint *point) { - if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width || - point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { - return false; - } + if (_overlayIsEnabled) { + point->x = point->x / _overlayHeight; + point->y = point->y / _overlayWidth; + } else { + if (point->x < _screenRect.origin.x || point->x >= _screenRect.origin.x + _screenRect.size.width || + point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { + return false; + } - point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width; - point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height; + point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width; + point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height; + } return true; } -- cgit v1.2.3