Use cursor position from mouse events for hit test
Otherwise user may accidentally trigger task resizing when performing multi-finger gestures on touchpads. Bug: 166337994 Test: handleTapOutsideTask() is skipped on touchpad gestures. Change-Id: I5251623addb3d10af4c1735ce2a6b919a511460f
This commit is contained in:
@@ -25,6 +25,7 @@ import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.view.InputDevice;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.WindowManagerPolicyConstants.PointerEventListener;
|
||||
|
||||
@@ -62,8 +63,15 @@ public class TaskTapPointerEventListener implements PointerEventListener {
|
||||
public void onPointerEvent(MotionEvent motionEvent) {
|
||||
switch (motionEvent.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
final int x = (int) motionEvent.getX();
|
||||
final int y = (int) motionEvent.getY();
|
||||
final int x;
|
||||
final int y;
|
||||
if (motionEvent.getSource() == InputDevice.SOURCE_MOUSE) {
|
||||
x = (int) motionEvent.getXCursorPosition();
|
||||
y = (int) motionEvent.getYCursorPosition();
|
||||
} else {
|
||||
x = (int) motionEvent.getX();
|
||||
y = (int) motionEvent.getY();
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (!mTouchExcludeRegion.contains(x, y)) {
|
||||
|
||||
Reference in New Issue
Block a user