diff options
| author | Garfield Tan <xutan@google.com> | 2019-10-04 14:36:32 -0700 |
|---|---|---|
| committer | Garfield Tan <xutan@google.com> | 2019-10-04 15:20:28 -0700 |
| commit | 63e6a35508833047c760dceedc05228189a431dc (patch) | |
| tree | 1a29bf5c0acd2d6ebd97d226a6f064bcdb298c14 /core/java/android/view/ViewGroup.java | |
| parent | f90c2775d640735e89c3da5e213cb70cfc44a82d (diff) | |
Dispatch mouse events to the view under cursor.
Events from touchpads may have multiple fingers on them, and the down
event may be active with a finger which coordinate isn't in the view
where the mouse cursor is. Need to make sure it's dispatched to the view
under the mouse cursor.
Bug: 140312476
Test: Two-finger scroll on DualShock 4 always happen in the view under
the cursor, regardless of the order of finger put on the touch pad.
Test: atest FrameworksCoreTests:ViewGroupTest
Change-Id: I679a0a38c830bd418bb412bc6f0d78ba5c93224a
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 9095dbe0165a..853a30226982 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2634,8 +2634,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final int childrenCount = mChildrenCount; if (newTouchTarget == null && childrenCount != 0) { - final float x = ev.getX(actionIndex); - final float y = ev.getY(actionIndex); + final float x = + isMouseEvent ? ev.getXCursorPosition() : ev.getX(actionIndex); + final float y = + isMouseEvent ? ev.getYCursorPosition() : ev.getY(actionIndex); // Find a child that can receive the event. // Scan children from front to back. final ArrayList<View> preorderedList = buildTouchDispatchChildList(); |
