mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 756474 - Harden the SimpleScaleGestureDectector against missed events [r=kats]
This commit is contained in:
parent
e84af3afd0
commit
aa807b4225
@ -251,16 +251,7 @@ public final class TouchEventHandler implements Tabs.OnTabsChangedListener {
|
||||
*/
|
||||
private void dispatchEvent(MotionEvent event) {
|
||||
if (mGestureDetector.onTouchEvent(event)) {
|
||||
// An up/cancel event should get passed to both detectors, in
|
||||
// case it comes from a pointer the scale detector is tracking.
|
||||
switch (event.getAction() & MotionEvent.ACTION_MASK) {
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
mScaleGestureDetector.onTouchEvent(event);
|
||||
if (mScaleGestureDetector.isInProgress()) {
|
||||
|
@ -51,6 +51,12 @@ public class SimpleScaleGestureDetector {
|
||||
public void onTouchEvent(MotionEvent event) {
|
||||
switch (event.getAction() & MotionEvent.ACTION_MASK) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// If we get ACTION_DOWN while still tracking any pointers,
|
||||
// something is wrong. Cancel the current gesture and start over.
|
||||
if (getPointersDown() > 0)
|
||||
onTouchEnd(event);
|
||||
onTouchStart(event);
|
||||
break;
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
onTouchStart(event);
|
||||
break;
|
||||
@ -99,7 +105,10 @@ public class SimpleScaleGestureDetector {
|
||||
private void onTouchEnd(MotionEvent event) {
|
||||
mLastEventTime = event.getEventTime();
|
||||
|
||||
boolean isCancel = (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_CANCEL;
|
||||
int action = event.getAction() & MotionEvent.ACTION_MASK;
|
||||
boolean isCancel = (action == MotionEvent.ACTION_CANCEL ||
|
||||
action == MotionEvent.ACTION_DOWN);
|
||||
|
||||
int id = event.getPointerId(getActionIndex(event));
|
||||
ListIterator<PointerInfo> iterator = mPointerInfo.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
Loading…
Reference in New Issue
Block a user