diff options
author | 2024-01-29 12:47:18 -0800 | |
---|---|---|
committer | 2024-01-29 12:47:18 -0800 | |
commit | 2d701e14093b2e699d7dca00db3d7d66d0c96e29 (patch) | |
tree | c1b5916d12ac356ec1732e50293b335475ea83d0 /libs/input/Input.cpp | |
parent | c6e22d8533cee1d044b88f2eb4a94a8b6c041761 (diff) | |
parent | b507b71cc52f9203657f221808eef04d58dd6398 (diff) |
Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I264e728c49f0500f2f868c3a25b0910d0d527340
Change-Id: I0de5ae0000a29e4b9735e6c4f381f680eb0723cd
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r-- | libs/input/Input.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 00925ba555..bd5b67b1d0 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -217,6 +217,19 @@ bool isStylusToolType(ToolType toolType) { return toolType == ToolType::STYLUS || toolType == ToolType::ERASER; } +bool isStylusEvent(uint32_t source, const std::vector<PointerProperties>& properties) { + if (!isFromSource(source, AINPUT_SOURCE_STYLUS)) { + return false; + } + // Need at least one stylus pointer for this event to be considered a stylus event + for (const PointerProperties& pointerProperties : properties) { + if (isStylusToolType(pointerProperties.toolType)) { + return true; + } + } + return false; +} + VerifiedKeyEvent verifiedKeyEventFromKeyEvent(const KeyEvent& event) { return {{VerifiedInputEvent::Type::KEY, event.getDeviceId(), event.getEventTime(), event.getSource(), event.getDisplayId()}, @@ -497,19 +510,6 @@ void PointerCoords::transform(const ui::Transform& transform) { } } -// --- PointerProperties --- - -bool PointerProperties::operator==(const PointerProperties& other) const { - return id == other.id - && toolType == other.toolType; -} - -void PointerProperties::copyFrom(const PointerProperties& other) { - id = other.id; - toolType = other.toolType; -} - - // --- MotionEvent --- void MotionEvent::initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId, |