diff options
Diffstat (limited to 'libs/ui/InputDispatcher.cpp')
-rw-r--r-- | libs/ui/InputDispatcher.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index 421ad663f8fd..90c85425dc8c 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -731,17 +731,19 @@ bool InputDispatcher::dispatchMotionLocked( return true; } - bool isPointerEvent = entry->source & AINPUT_SOURCE_CLASS_POINTER; + bool isTouchEvent = ! ((entry->source & AINPUT_SOURCE_TOUCHSCREEN) ^ AINPUT_SOURCE_TOUCHSCREEN); + bool isMouseEvent = ! ((entry->source & AINPUT_SOURCE_MOUSE) ^ AINPUT_SOURCE_MOUSE); + bool isDownEvent = (entry->action & AMOTION_EVENT_ACTION_MASK) == AMOTION_EVENT_ACTION_DOWN; // Identify targets. if (! mCurrentInputTargetsValid) { int32_t injectionResult; - if (isPointerEvent) { - // Pointer event. (eg. touchscreen) + if (isTouchEvent || (isMouseEvent && (isDownEvent || mTouchState.down))) { + // Touch-like event. (eg. touchscreen or mouse drag-n-drop ) injectionResult = findTouchedWindowTargetsLocked(currentTime, entry, nextWakeupTime); } else { - // Non touch event. (eg. trackball) + // Non touch event. (eg. trackball or mouse simple move) injectionResult = findFocusedWindowTargetsLocked(currentTime, entry, nextWakeupTime); } |