Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1bf6f87 authored by Garfield Tan's avatar Garfield Tan
Browse files

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
parent 1043401f
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Region;
import android.hardware.input.InputManager;
import android.hardware.input.InputManager;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import android.view.WindowManagerPolicyConstants.PointerEventListener;


@@ -62,8 +63,15 @@ public class TaskTapPointerEventListener implements PointerEventListener {
    public void onPointerEvent(MotionEvent motionEvent) {
    public void onPointerEvent(MotionEvent motionEvent) {
        switch (motionEvent.getActionMasked()) {
        switch (motionEvent.getActionMasked()) {
            case MotionEvent.ACTION_DOWN: {
            case MotionEvent.ACTION_DOWN: {
                final int x = (int) motionEvent.getX();
                final int x;
                final int y = (int) motionEvent.getY();
                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) {
                synchronized (this) {
                    if (!mTouchExcludeRegion.contains(x, y)) {
                    if (!mTouchExcludeRegion.contains(x, y)) {