summaryrefslogtreecommitdiff
path: root/libs/input/Input.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r--libs/input/Input.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index c1274110d3..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()},