Loading libs/input/input_flags.aconfig +0 −10 Original line number Original line Diff line number Diff line Loading @@ -151,16 +151,6 @@ flag { is_fixed_read_only: true is_fixed_read_only: true } } flag { name: "disable_touch_input_mapper_pointer_usage" namespace: "input" description: "Disable the PointerUsage concept in TouchInputMapper since the old touchpad stack is no longer used." bug: "281840344" metadata { purpose: PURPOSE_BUGFIX } } flag { flag { name: "keyboard_repeat_keys" name: "keyboard_repeat_keys" namespace: "input" namespace: "input" Loading services/inputflinger/include/InputReaderBase.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -161,7 +161,7 @@ struct InputReaderConfiguration { // For mice, these are ignored and the values of mousePointerSpeed and // For mice, these are ignored and the values of mousePointerSpeed and // mousePointerAccelerationEnabled used instead. // mousePointerAccelerationEnabled used instead. // // // TODO(b/281840344): remove this. // TODO(b/281840344): remove, and check if other fields beginning with pointer… are still used. VelocityControlParameters pointerVelocityControlParameters; VelocityControlParameters pointerVelocityControlParameters; // Velocity control parameters for mouse wheel movements. // Velocity control parameters for mouse wheel movements. Loading services/inputflinger/reader/Macros.h +0 −7 Original line number Original line Diff line number Diff line Loading @@ -55,13 +55,6 @@ const bool DEBUG_POINTERS = const bool DEBUG_POINTER_ASSIGNMENT = const bool DEBUG_POINTER_ASSIGNMENT = __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "PointerAssignment", ANDROID_LOG_INFO); __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "PointerAssignment", ANDROID_LOG_INFO); /** * Log debug messages about gesture detection. * Enable this via "adb shell setprop log.tag.InputReaderGestures DEBUG" (requires restart) */ const bool DEBUG_GESTURES = __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Gestures", ANDROID_LOG_INFO); /** /** * Log debug messages about the vibrator. * Log debug messages about the vibrator. * Enable this via "adb shell setprop log.tag.InputReaderVibrator DEBUG" (requires restart) * Enable this via "adb shell setprop log.tag.InputReaderVibrator DEBUG" (requires restart) Loading services/inputflinger/reader/mapper/TouchInputMapper.cpp +13 −1411 File changed.Preview size limit exceeded, changes collapsed. Show changes services/inputflinger/reader/mapper/TouchInputMapper.h +0 −285 Original line number Original line Diff line number Diff line Loading @@ -23,14 +23,11 @@ #include <memory> #include <memory> #include <optional> #include <optional> #include <string> #include <string> #include <utility> #include <vector> #include <vector> #include <input/DisplayViewport.h> #include <input/DisplayViewport.h> #include <input/Input.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputDevice.h> #include <input/VelocityControl.h> #include <input/VelocityTracker.h> #include <stdint.h> #include <stdint.h> #include <ui/Rect.h> #include <ui/Rect.h> #include <ui/Rotation.h> #include <ui/Rotation.h> Loading @@ -40,7 +37,6 @@ #include <utils/Timers.h> #include <utils/Timers.h> #include "CursorButtonAccumulator.h" #include "CursorButtonAccumulator.h" #include "CursorScrollAccumulator.h" #include "EventHub.h" #include "EventHub.h" #include "InputMapper.h" #include "InputMapper.h" #include "InputReaderBase.h" #include "InputReaderBase.h" Loading Loading @@ -109,8 +105,6 @@ struct RawPointerData { inline void clear() { *this = RawPointerData(); } inline void clear() { *this = RawPointerData(); } void getCentroidOfTouchingPointers(float* outX, float* outY) const; inline void markIdBit(uint32_t id, bool isHovering) { inline void markIdBit(uint32_t id, bool isHovering) { if (isHovering) { if (isHovering) { hoveringIdBits.markBit(id); hoveringIdBits.markBit(id); Loading Loading @@ -189,7 +183,6 @@ public: protected: protected: CursorButtonAccumulator mCursorButtonAccumulator; CursorButtonAccumulator mCursorButtonAccumulator; CursorScrollAccumulator mCursorScrollAccumulator; TouchButtonAccumulator mTouchButtonAccumulator; TouchButtonAccumulator mTouchButtonAccumulator; struct VirtualKey { struct VirtualKey { Loading Loading @@ -244,7 +237,6 @@ protected: ui::Rotation orientation; ui::Rotation orientation; bool hasButtonUnderPad; std::string uniqueDisplayId; std::string uniqueDisplayId; enum class GestureMode { enum class GestureMode { Loading Loading @@ -341,10 +333,6 @@ protected: int32_t buttonState{}; int32_t buttonState{}; // Scroll state. float rawVScroll{}; float rawHScroll{}; inline void clear() { *this = RawState(); } inline void clear() { *this = RawState(); } }; }; Loading @@ -354,11 +342,6 @@ protected: // Cooked pointer sample data. // Cooked pointer sample data. CookedPointerData cookedPointerData{}; CookedPointerData cookedPointerData{}; // Id bits used to differentiate fingers, stylus and mouse tools. BitSet32 fingerIdBits{}; BitSet32 stylusIdBits{}; BitSet32 mouseIdBits{}; int32_t buttonState{}; int32_t buttonState{}; inline void clear() { *this = CookedState(); } inline void clear() { *this = CookedState(); } Loading Loading @@ -519,229 +502,12 @@ private: int32_t scanCode; int32_t scanCode; } mCurrentVirtualKey; } mCurrentVirtualKey; // Scale factor for gesture or mouse based pointer movements. float mPointerXMovementScale; float mPointerYMovementScale; // Scale factor for gesture based zooming and other freeform motions. float mPointerXZoomScale; float mPointerYZoomScale; // The maximum swipe width between pointers to detect a swipe gesture // in the number of pixels.Touches that are wider than this are translated // into freeform gestures. float mPointerGestureMaxSwipeWidth; struct PointerDistanceHeapElement { struct PointerDistanceHeapElement { uint32_t currentPointerIndex : 8 {}; uint32_t currentPointerIndex : 8 {}; uint32_t lastPointerIndex : 8 {}; uint32_t lastPointerIndex : 8 {}; uint64_t distance : 48 {}; // squared distance uint64_t distance : 48 {}; // squared distance }; }; enum class PointerUsage { NONE, GESTURES, STYLUS, MOUSE, }; PointerUsage mPointerUsage{PointerUsage::NONE}; struct PointerGesture { enum class Mode { // No fingers, button is not pressed. // Nothing happening. NEUTRAL, // No fingers, button is not pressed. // Tap detected. // Emits DOWN and UP events at the pointer location. TAP, // Exactly one finger dragging following a tap. // Pointer follows the active finger. // Emits DOWN, MOVE and UP events at the pointer location. // // Detect double-taps when the finger goes up while in TAP_DRAG mode. TAP_DRAG, // Button is pressed. // Pointer follows the active finger if there is one. Other fingers are ignored. // Emits DOWN, MOVE and UP events at the pointer location. BUTTON_CLICK_OR_DRAG, // Exactly one finger, button is not pressed. // Pointer follows the active finger. // Emits HOVER_MOVE events at the pointer location. // // Detect taps when the finger goes up while in HOVER mode. HOVER, // Exactly two fingers but neither have moved enough to clearly indicate // whether a swipe or freeform gesture was intended. We consider the // pointer to be pressed so this enables clicking or long-pressing on buttons. // Pointer does not move. // Emits DOWN, MOVE and UP events with a single stationary pointer coordinate. PRESS, // Exactly two fingers moving in the same direction, button is not pressed. // Pointer does not move. // Emits DOWN, MOVE and UP events with a single pointer coordinate that // follows the midpoint between both fingers. SWIPE, // Two or more fingers moving in arbitrary directions, button is not pressed. // Pointer does not move. // Emits DOWN, POINTER_DOWN, MOVE, POINTER_UP and UP events that follow // each finger individually relative to the initial centroid of the finger. FREEFORM, // Waiting for quiet time to end before starting the next gesture. QUIET, ftl_last = QUIET, }; // When a gesture is sent to an unfocused window, return true if it can bring that window // into focus, false otherwise. static bool canGestureAffectWindowFocus(Mode mode) { switch (mode) { case Mode::TAP: case Mode::TAP_DRAG: case Mode::BUTTON_CLICK_OR_DRAG: // Taps can affect window focus. return true; case Mode::FREEFORM: case Mode::HOVER: case Mode::NEUTRAL: case Mode::PRESS: case Mode::QUIET: case Mode::SWIPE: // Most gestures can be performed on an unfocused window, so they should not // not affect window focus. return false; } } // Time the first finger went down. nsecs_t firstTouchTime; // The active pointer id from the raw touch data. int32_t activeTouchId; // -1 if none // The active pointer id from the gesture last delivered to the application. int32_t activeGestureId; // -1 if none // Pointer coords and ids for the current and previous pointer gesture. Mode currentGestureMode; BitSet32 currentGestureIdBits; IdToIndexArray currentGestureIdToIndex{}; PropertiesArray currentGestureProperties{}; CoordsArray currentGestureCoords{}; Mode lastGestureMode; BitSet32 lastGestureIdBits; IdToIndexArray lastGestureIdToIndex{}; PropertiesArray lastGestureProperties{}; CoordsArray lastGestureCoords{}; // Time the pointer gesture last went down. nsecs_t downTime; // Time when the pointer went down for a TAP. nsecs_t tapDownTime; // Time when the pointer went up for a TAP. nsecs_t tapUpTime; // Location of initial tap. float tapX, tapY; // Time we started waiting for quiescence. nsecs_t quietTime; // Reference points for multitouch gestures. float referenceTouchX; // reference touch X/Y coordinates in surface units float referenceTouchY; float referenceGestureX; // reference gesture X/Y coordinates in pixels float referenceGestureY; // Distance that each pointer has traveled which has not yet been // subsumed into the reference gesture position. BitSet32 referenceIdBits; struct Delta { float dx, dy; }; Delta referenceDeltas[MAX_POINTER_ID + 1]; // Describes how touch ids are mapped to gesture ids for freeform gestures. uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1]; // A velocity tracker for determining whether to switch active pointers during drags. VelocityTracker velocityTracker; void reset() { firstTouchTime = LLONG_MIN; activeTouchId = -1; activeGestureId = -1; currentGestureMode = Mode::NEUTRAL; currentGestureIdBits.clear(); lastGestureMode = Mode::NEUTRAL; lastGestureIdBits.clear(); downTime = 0; velocityTracker.clear(); resetTap(); resetQuietTime(); } void resetTap() { tapDownTime = LLONG_MIN; tapUpTime = LLONG_MIN; } void resetQuietTime() { quietTime = LLONG_MIN; } } mPointerGesture; struct PointerSimple { PointerCoords currentCoords; PointerProperties currentProperties; PointerCoords lastCoords; PointerProperties lastProperties; // True if the pointer is down. bool down; // True if the pointer is hovering. bool hovering; // Time the pointer last went down. nsecs_t downTime; // Values reported for the last pointer event. uint32_t source; ui::LogicalDisplayId displayId{ui::LogicalDisplayId::INVALID}; float lastCursorX; float lastCursorY; void reset() { currentCoords.clear(); currentProperties.clear(); lastCoords.clear(); lastProperties.clear(); down = false; hovering = false; downTime = 0; source = 0; displayId = ui::LogicalDisplayId::INVALID; lastCursorX = 0.f; lastCursorY = 0.f; } } mPointerSimple; // The pointer and scroll velocity controls. SimpleVelocityControl mPointerVelocityControl; SimpleVelocityControl mWheelXVelocityControl; SimpleVelocityControl mWheelYVelocityControl; std::optional<DisplayViewport> findViewport(); std::optional<DisplayViewport> findViewport(); void resetExternalStylus(); void resetExternalStylus(); Loading Loading @@ -771,63 +537,12 @@ private: uint32_t policyFlags); uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchButtonPress(nsecs_t when, nsecs_t readTime, [[nodiscard]] std::list<NotifyArgs> dispatchButtonPress(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchGestureButtonPress(nsecs_t when, uint32_t policyFlags, BitSet32 idBits, nsecs_t readTime); [[nodiscard]] std::list<NotifyArgs> dispatchGestureButtonRelease(nsecs_t when, uint32_t policyFlags, BitSet32 idBits, nsecs_t readTime); const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData); const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData); void cookPointerData(); void cookPointerData(); [[nodiscard]] std::list<NotifyArgs> abortTouches( [[nodiscard]] std::list<NotifyArgs> abortTouches( nsecs_t when, nsecs_t readTime, uint32_t policyFlags, nsecs_t when, nsecs_t readTime, uint32_t policyFlags, std::optional<ui::LogicalDisplayId> gestureDisplayId); std::optional<ui::LogicalDisplayId> gestureDisplayId); [[nodiscard]] std::list<NotifyArgs> dispatchPointerUsage(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, PointerUsage pointerUsage); [[nodiscard]] std::list<NotifyArgs> abortPointerUsage(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerGestures(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, bool isTimeout); [[nodiscard]] std::list<NotifyArgs> abortPointerGestures(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); bool preparePointerGestures(nsecs_t when, bool* outCancelPreviousGesture, bool* outFinishPreviousGesture, bool isTimeout); // Returns true if we're in a period of "quiet time" when touchpad gestures should be ignored. bool checkForTouchpadQuietTime(nsecs_t when); std::pair<int32_t, float> getFastestFinger(); void prepareMultiFingerPointerGestures(nsecs_t when, bool* outCancelPreviousGesture, bool* outFinishPreviousGesture); // Moves the on-screen mouse pointer based on the movement of the pointer of the given ID // between the last and current events. Uses a relative motion. void moveMousePointerFromPointerDelta(nsecs_t when, uint32_t pointerId); [[nodiscard]] std::list<NotifyArgs> dispatchPointerStylus(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> abortPointerStylus(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerMouse(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> abortPointerMouse(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerSimple(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, bool down, bool hovering, ui::LogicalDisplayId displayId); [[nodiscard]] std::list<NotifyArgs> abortPointerSimple(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); // Attempts to assign a pointer id to the external stylus. Returns true if the state should be // Attempts to assign a pointer id to the external stylus. Returns true if the state should be // withheld from further processing while waiting for data from the stylus. // withheld from further processing while waiting for data from the stylus. bool assignExternalStylusId(const RawState& state, bool timeout); bool assignExternalStylusId(const RawState& state, bool timeout); Loading Loading
libs/input/input_flags.aconfig +0 −10 Original line number Original line Diff line number Diff line Loading @@ -151,16 +151,6 @@ flag { is_fixed_read_only: true is_fixed_read_only: true } } flag { name: "disable_touch_input_mapper_pointer_usage" namespace: "input" description: "Disable the PointerUsage concept in TouchInputMapper since the old touchpad stack is no longer used." bug: "281840344" metadata { purpose: PURPOSE_BUGFIX } } flag { flag { name: "keyboard_repeat_keys" name: "keyboard_repeat_keys" namespace: "input" namespace: "input" Loading
services/inputflinger/include/InputReaderBase.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -161,7 +161,7 @@ struct InputReaderConfiguration { // For mice, these are ignored and the values of mousePointerSpeed and // For mice, these are ignored and the values of mousePointerSpeed and // mousePointerAccelerationEnabled used instead. // mousePointerAccelerationEnabled used instead. // // // TODO(b/281840344): remove this. // TODO(b/281840344): remove, and check if other fields beginning with pointer… are still used. VelocityControlParameters pointerVelocityControlParameters; VelocityControlParameters pointerVelocityControlParameters; // Velocity control parameters for mouse wheel movements. // Velocity control parameters for mouse wheel movements. Loading
services/inputflinger/reader/Macros.h +0 −7 Original line number Original line Diff line number Diff line Loading @@ -55,13 +55,6 @@ const bool DEBUG_POINTERS = const bool DEBUG_POINTER_ASSIGNMENT = const bool DEBUG_POINTER_ASSIGNMENT = __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "PointerAssignment", ANDROID_LOG_INFO); __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "PointerAssignment", ANDROID_LOG_INFO); /** * Log debug messages about gesture detection. * Enable this via "adb shell setprop log.tag.InputReaderGestures DEBUG" (requires restart) */ const bool DEBUG_GESTURES = __android_log_is_loggable(ANDROID_LOG_DEBUG, LOG_TAG "Gestures", ANDROID_LOG_INFO); /** /** * Log debug messages about the vibrator. * Log debug messages about the vibrator. * Enable this via "adb shell setprop log.tag.InputReaderVibrator DEBUG" (requires restart) * Enable this via "adb shell setprop log.tag.InputReaderVibrator DEBUG" (requires restart) Loading
services/inputflinger/reader/mapper/TouchInputMapper.cpp +13 −1411 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/inputflinger/reader/mapper/TouchInputMapper.h +0 −285 Original line number Original line Diff line number Diff line Loading @@ -23,14 +23,11 @@ #include <memory> #include <memory> #include <optional> #include <optional> #include <string> #include <string> #include <utility> #include <vector> #include <vector> #include <input/DisplayViewport.h> #include <input/DisplayViewport.h> #include <input/Input.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputDevice.h> #include <input/VelocityControl.h> #include <input/VelocityTracker.h> #include <stdint.h> #include <stdint.h> #include <ui/Rect.h> #include <ui/Rect.h> #include <ui/Rotation.h> #include <ui/Rotation.h> Loading @@ -40,7 +37,6 @@ #include <utils/Timers.h> #include <utils/Timers.h> #include "CursorButtonAccumulator.h" #include "CursorButtonAccumulator.h" #include "CursorScrollAccumulator.h" #include "EventHub.h" #include "EventHub.h" #include "InputMapper.h" #include "InputMapper.h" #include "InputReaderBase.h" #include "InputReaderBase.h" Loading Loading @@ -109,8 +105,6 @@ struct RawPointerData { inline void clear() { *this = RawPointerData(); } inline void clear() { *this = RawPointerData(); } void getCentroidOfTouchingPointers(float* outX, float* outY) const; inline void markIdBit(uint32_t id, bool isHovering) { inline void markIdBit(uint32_t id, bool isHovering) { if (isHovering) { if (isHovering) { hoveringIdBits.markBit(id); hoveringIdBits.markBit(id); Loading Loading @@ -189,7 +183,6 @@ public: protected: protected: CursorButtonAccumulator mCursorButtonAccumulator; CursorButtonAccumulator mCursorButtonAccumulator; CursorScrollAccumulator mCursorScrollAccumulator; TouchButtonAccumulator mTouchButtonAccumulator; TouchButtonAccumulator mTouchButtonAccumulator; struct VirtualKey { struct VirtualKey { Loading Loading @@ -244,7 +237,6 @@ protected: ui::Rotation orientation; ui::Rotation orientation; bool hasButtonUnderPad; std::string uniqueDisplayId; std::string uniqueDisplayId; enum class GestureMode { enum class GestureMode { Loading Loading @@ -341,10 +333,6 @@ protected: int32_t buttonState{}; int32_t buttonState{}; // Scroll state. float rawVScroll{}; float rawHScroll{}; inline void clear() { *this = RawState(); } inline void clear() { *this = RawState(); } }; }; Loading @@ -354,11 +342,6 @@ protected: // Cooked pointer sample data. // Cooked pointer sample data. CookedPointerData cookedPointerData{}; CookedPointerData cookedPointerData{}; // Id bits used to differentiate fingers, stylus and mouse tools. BitSet32 fingerIdBits{}; BitSet32 stylusIdBits{}; BitSet32 mouseIdBits{}; int32_t buttonState{}; int32_t buttonState{}; inline void clear() { *this = CookedState(); } inline void clear() { *this = CookedState(); } Loading Loading @@ -519,229 +502,12 @@ private: int32_t scanCode; int32_t scanCode; } mCurrentVirtualKey; } mCurrentVirtualKey; // Scale factor for gesture or mouse based pointer movements. float mPointerXMovementScale; float mPointerYMovementScale; // Scale factor for gesture based zooming and other freeform motions. float mPointerXZoomScale; float mPointerYZoomScale; // The maximum swipe width between pointers to detect a swipe gesture // in the number of pixels.Touches that are wider than this are translated // into freeform gestures. float mPointerGestureMaxSwipeWidth; struct PointerDistanceHeapElement { struct PointerDistanceHeapElement { uint32_t currentPointerIndex : 8 {}; uint32_t currentPointerIndex : 8 {}; uint32_t lastPointerIndex : 8 {}; uint32_t lastPointerIndex : 8 {}; uint64_t distance : 48 {}; // squared distance uint64_t distance : 48 {}; // squared distance }; }; enum class PointerUsage { NONE, GESTURES, STYLUS, MOUSE, }; PointerUsage mPointerUsage{PointerUsage::NONE}; struct PointerGesture { enum class Mode { // No fingers, button is not pressed. // Nothing happening. NEUTRAL, // No fingers, button is not pressed. // Tap detected. // Emits DOWN and UP events at the pointer location. TAP, // Exactly one finger dragging following a tap. // Pointer follows the active finger. // Emits DOWN, MOVE and UP events at the pointer location. // // Detect double-taps when the finger goes up while in TAP_DRAG mode. TAP_DRAG, // Button is pressed. // Pointer follows the active finger if there is one. Other fingers are ignored. // Emits DOWN, MOVE and UP events at the pointer location. BUTTON_CLICK_OR_DRAG, // Exactly one finger, button is not pressed. // Pointer follows the active finger. // Emits HOVER_MOVE events at the pointer location. // // Detect taps when the finger goes up while in HOVER mode. HOVER, // Exactly two fingers but neither have moved enough to clearly indicate // whether a swipe or freeform gesture was intended. We consider the // pointer to be pressed so this enables clicking or long-pressing on buttons. // Pointer does not move. // Emits DOWN, MOVE and UP events with a single stationary pointer coordinate. PRESS, // Exactly two fingers moving in the same direction, button is not pressed. // Pointer does not move. // Emits DOWN, MOVE and UP events with a single pointer coordinate that // follows the midpoint between both fingers. SWIPE, // Two or more fingers moving in arbitrary directions, button is not pressed. // Pointer does not move. // Emits DOWN, POINTER_DOWN, MOVE, POINTER_UP and UP events that follow // each finger individually relative to the initial centroid of the finger. FREEFORM, // Waiting for quiet time to end before starting the next gesture. QUIET, ftl_last = QUIET, }; // When a gesture is sent to an unfocused window, return true if it can bring that window // into focus, false otherwise. static bool canGestureAffectWindowFocus(Mode mode) { switch (mode) { case Mode::TAP: case Mode::TAP_DRAG: case Mode::BUTTON_CLICK_OR_DRAG: // Taps can affect window focus. return true; case Mode::FREEFORM: case Mode::HOVER: case Mode::NEUTRAL: case Mode::PRESS: case Mode::QUIET: case Mode::SWIPE: // Most gestures can be performed on an unfocused window, so they should not // not affect window focus. return false; } } // Time the first finger went down. nsecs_t firstTouchTime; // The active pointer id from the raw touch data. int32_t activeTouchId; // -1 if none // The active pointer id from the gesture last delivered to the application. int32_t activeGestureId; // -1 if none // Pointer coords and ids for the current and previous pointer gesture. Mode currentGestureMode; BitSet32 currentGestureIdBits; IdToIndexArray currentGestureIdToIndex{}; PropertiesArray currentGestureProperties{}; CoordsArray currentGestureCoords{}; Mode lastGestureMode; BitSet32 lastGestureIdBits; IdToIndexArray lastGestureIdToIndex{}; PropertiesArray lastGestureProperties{}; CoordsArray lastGestureCoords{}; // Time the pointer gesture last went down. nsecs_t downTime; // Time when the pointer went down for a TAP. nsecs_t tapDownTime; // Time when the pointer went up for a TAP. nsecs_t tapUpTime; // Location of initial tap. float tapX, tapY; // Time we started waiting for quiescence. nsecs_t quietTime; // Reference points for multitouch gestures. float referenceTouchX; // reference touch X/Y coordinates in surface units float referenceTouchY; float referenceGestureX; // reference gesture X/Y coordinates in pixels float referenceGestureY; // Distance that each pointer has traveled which has not yet been // subsumed into the reference gesture position. BitSet32 referenceIdBits; struct Delta { float dx, dy; }; Delta referenceDeltas[MAX_POINTER_ID + 1]; // Describes how touch ids are mapped to gesture ids for freeform gestures. uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1]; // A velocity tracker for determining whether to switch active pointers during drags. VelocityTracker velocityTracker; void reset() { firstTouchTime = LLONG_MIN; activeTouchId = -1; activeGestureId = -1; currentGestureMode = Mode::NEUTRAL; currentGestureIdBits.clear(); lastGestureMode = Mode::NEUTRAL; lastGestureIdBits.clear(); downTime = 0; velocityTracker.clear(); resetTap(); resetQuietTime(); } void resetTap() { tapDownTime = LLONG_MIN; tapUpTime = LLONG_MIN; } void resetQuietTime() { quietTime = LLONG_MIN; } } mPointerGesture; struct PointerSimple { PointerCoords currentCoords; PointerProperties currentProperties; PointerCoords lastCoords; PointerProperties lastProperties; // True if the pointer is down. bool down; // True if the pointer is hovering. bool hovering; // Time the pointer last went down. nsecs_t downTime; // Values reported for the last pointer event. uint32_t source; ui::LogicalDisplayId displayId{ui::LogicalDisplayId::INVALID}; float lastCursorX; float lastCursorY; void reset() { currentCoords.clear(); currentProperties.clear(); lastCoords.clear(); lastProperties.clear(); down = false; hovering = false; downTime = 0; source = 0; displayId = ui::LogicalDisplayId::INVALID; lastCursorX = 0.f; lastCursorY = 0.f; } } mPointerSimple; // The pointer and scroll velocity controls. SimpleVelocityControl mPointerVelocityControl; SimpleVelocityControl mWheelXVelocityControl; SimpleVelocityControl mWheelYVelocityControl; std::optional<DisplayViewport> findViewport(); std::optional<DisplayViewport> findViewport(); void resetExternalStylus(); void resetExternalStylus(); Loading Loading @@ -771,63 +537,12 @@ private: uint32_t policyFlags); uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchButtonPress(nsecs_t when, nsecs_t readTime, [[nodiscard]] std::list<NotifyArgs> dispatchButtonPress(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchGestureButtonPress(nsecs_t when, uint32_t policyFlags, BitSet32 idBits, nsecs_t readTime); [[nodiscard]] std::list<NotifyArgs> dispatchGestureButtonRelease(nsecs_t when, uint32_t policyFlags, BitSet32 idBits, nsecs_t readTime); const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData); const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData); void cookPointerData(); void cookPointerData(); [[nodiscard]] std::list<NotifyArgs> abortTouches( [[nodiscard]] std::list<NotifyArgs> abortTouches( nsecs_t when, nsecs_t readTime, uint32_t policyFlags, nsecs_t when, nsecs_t readTime, uint32_t policyFlags, std::optional<ui::LogicalDisplayId> gestureDisplayId); std::optional<ui::LogicalDisplayId> gestureDisplayId); [[nodiscard]] std::list<NotifyArgs> dispatchPointerUsage(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, PointerUsage pointerUsage); [[nodiscard]] std::list<NotifyArgs> abortPointerUsage(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerGestures(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, bool isTimeout); [[nodiscard]] std::list<NotifyArgs> abortPointerGestures(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); bool preparePointerGestures(nsecs_t when, bool* outCancelPreviousGesture, bool* outFinishPreviousGesture, bool isTimeout); // Returns true if we're in a period of "quiet time" when touchpad gestures should be ignored. bool checkForTouchpadQuietTime(nsecs_t when); std::pair<int32_t, float> getFastestFinger(); void prepareMultiFingerPointerGestures(nsecs_t when, bool* outCancelPreviousGesture, bool* outFinishPreviousGesture); // Moves the on-screen mouse pointer based on the movement of the pointer of the given ID // between the last and current events. Uses a relative motion. void moveMousePointerFromPointerDelta(nsecs_t when, uint32_t pointerId); [[nodiscard]] std::list<NotifyArgs> dispatchPointerStylus(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> abortPointerStylus(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerMouse(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> abortPointerMouse(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); [[nodiscard]] std::list<NotifyArgs> dispatchPointerSimple(nsecs_t when, nsecs_t readTime, uint32_t policyFlags, bool down, bool hovering, ui::LogicalDisplayId displayId); [[nodiscard]] std::list<NotifyArgs> abortPointerSimple(nsecs_t when, nsecs_t readTime, uint32_t policyFlags); // Attempts to assign a pointer id to the external stylus. Returns true if the state should be // Attempts to assign a pointer id to the external stylus. Returns true if the state should be // withheld from further processing while waiting for data from the stylus. // withheld from further processing while waiting for data from the stylus. bool assignExternalStylusId(const RawState& state, bool timeout); bool assignExternalStylusId(const RawState& state, bool timeout); Loading