diff options
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, |