mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 03:10:22 +00:00
IOS7: Cancel pending button if touch is moved within 250 ms
If not in "click-and-drag" mode, left mouse button down and up events are sent on touches ended if the touch lasted less than 250 ms. If the touch lasted longer it was considered as a move and no button events are sent. This commit mimic that behaviour in touchpad mode when "click- and-drag" mode is enabled. The left mouse button down event is queued for 250 ms. If the touch is dragged within 250 ms it is considered as a move and the queued mouse button down event is cacelled. If no movement is made withing 250 ms the queued mouse button event is processed.
This commit is contained in:
parent
b324c70748
commit
598bc231ab
@ -192,8 +192,14 @@ bool OSystem_iOS7::handleEvent_touchFirstDown(Common::Event &event, int x, int y
|
||||
}
|
||||
|
||||
if (_mouseClickAndDragEnabled) {
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
handleEvent_mouseEvent(event, 0, 0);
|
||||
if (_touchpadModeEnabled) {
|
||||
_queuedInputEvent.type = Common::EVENT_LBUTTONDOWN;
|
||||
_queuedEventTime = getMillis() + 250;
|
||||
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
|
||||
} else {
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
handleEvent_mouseEvent(event, 0, 0);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
_lastMouseDown = getMillis();
|
||||
@ -209,8 +215,16 @@ bool OSystem_iOS7::handleEvent_touchFirstUp(Common::Event &event, int x, int y)
|
||||
if (!handleEvent_touchSecondUp(event, x, y))
|
||||
return false;
|
||||
} else if (_mouseClickAndDragEnabled) {
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
handleEvent_mouseEvent(event, 0, 0);
|
||||
if (_touchpadModeEnabled && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
|
||||
// This has not been sent yet, send it right away
|
||||
event = _queuedInputEvent;
|
||||
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
|
||||
_queuedEventTime = getMillis() + kQueuedInputEventDelay;
|
||||
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
|
||||
} else {
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
handleEvent_mouseEvent(event, 0, 0);
|
||||
}
|
||||
} else {
|
||||
if (getMillis() - _lastMouseDown < 250) {
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
@ -286,6 +300,10 @@ bool OSystem_iOS7::handleEvent_touchFirstDragged(Common::Event &event, int x, in
|
||||
_lastPadY = y;
|
||||
|
||||
if (_touchpadModeEnabled) {
|
||||
if (_mouseClickAndDragEnabled && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
|
||||
// Cancel the button down event since this was a pure mouse move
|
||||
_queuedInputEvent.type = Common::EVENT_INVALID;
|
||||
}
|
||||
handleEvent_mouseDelta(event, deltaX, deltaY);
|
||||
} else {
|
||||
// Update mouse position
|
||||
|
Loading…
Reference in New Issue
Block a user