[core] Partial fix gestures for PLATFORM_DRM
#3502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
The issue with the gesture system on
PLATFORM_DRM
is thatProcessGestureEvent(gestureEvent)
is called byEventThread()
(L1729) that runs on its own thread. By the timePollInputEvents()
callsUpdateGestures()
(L539) theGESTURE.current
has been overwritten. That causes the meaningful gestures to not be detected when callingGetGestureDetected()
(L431) orIsGestureDetected()
(L258).This partial fix attempts to address that by moving the
ProcessGestureEvent(gestureEvent)
call fromEventThread()
(L1729) toPollInputEvents()
(R607), where it runs consistently and in a predictable manner.It does that by making
GestureEvent gestureEvent
a global variable (R174) that will hold the data from the gesture generated duringEventThread()
. ThatgestureEvent
will then be used insidePollInputEvents()
when callingProcessGestureEvent(gestureEvent)
(R607).To only run
ProcessGestureEvent(gestureEvent)
when there's a new gesture (R605), a new control varnewGesture
was added (R175) and is reseted after theProcessGestureEvent(gestureEvent)
call (R608).This fixes the gestures detection for
GESTURE_TAP
,GESTURE_DOUBLETAP
andGESTURE_HOLD
.The
GESTURE_DRAG
andGESTURE_SWIPE_*
work, but are not reliable. There's some other issue with the touch position or reset that is causing them to not be precise as on other platforms. I believe that's related to the way they are pulled from evdev insideEventThread()
(L1569-L1706), but I was not able to finish debugging it yet.Note
GESTURE_DRAG
andGESTURE_SWIPE_*
to malfunction, so I don't think I'll be able to get this fully fixed fast enough for the5.0
release. This PR, however, should at least restore basic gesture operation forPLATFORM_DRM
in the meantime.Reference
Environment
Edits