Merge "Use cursor position from mouse events for hit test"
This commit is contained in:
committed by
Android (Google) Code Review
commit
cb00aa3386
@@ -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