@@ -77,6 +77,9 @@ void VoodooI2CGoodixEventDriver::fingerLift() {
7777 fingerDown = false ;
7878 currentInteractionType = HOVER;
7979
80+ // Reset multitouch status so we can get single finger interactions again
81+ isMultitouch = false ;
82+
8083 scrollStarted = false ;
8184
8285 // Reset all transducers
@@ -147,6 +150,10 @@ void VoodooI2CGoodixEventDriver::handleSingletouchInteraction(Touch touch, bool
147150 IOLog (" %s::Still hovering at %d, %d\n " , getName (), nextLogicalX, nextLogicalY);
148151 #endif
149152
153+ // Wait a tick to begin the click check
154+ // This helps avoid phantom clicks
155+ scheduleClickCheck ();
156+
150157 // Check for a right click
151158 if (currentInteractionType == RIGHT_CLICK) {
152159 // Keep the right mousebutton down in the same place
@@ -211,9 +218,6 @@ void VoodooI2CGoodixEventDriver::handleSingletouchInteraction(Touch touch, bool
211218 nextLogicalY = logicalY;
212219 currentInteractionType = LEFT_CLICK;
213220
214- // Every interaction could be a click, so check for one in a bit
215- scheduleClickCheck ();
216-
217221 #ifdef GOODIX_EVENT_DRIVER_DEBUG
218222 IOLog (" %s::Began hover at %d, %d\n " , getName (), nextLogicalX, nextLogicalY);
219223 #endif
@@ -253,8 +257,15 @@ void VoodooI2CGoodixEventDriver::handleMultitouchInteraction(struct Touch touche
253257 dispatchDigitizerEvent ((touches[0 ].x + touches[1 ].x ) / 2 , (touches[0 ].y + touches[1 ].y ) / 2 , HOVER);
254258
255259 scrollStarted = true ;
260+ #ifdef GOODIX_EVENT_DRIVER_DEBUG
261+ IOLog (" %s::Starting scroll\n " , getName ());
262+ #endif
256263 }
257264
265+ #ifdef GOODIX_EVENT_DRIVER_DEBUG
266+ IOLog (" %s::Handling multitouch with %d fingers\n " , getName (), numTouches);
267+ #endif
268+
258269 AbsoluteTime timestamp;
259270 clock_get_uptime (×tamp);
260271
@@ -292,9 +303,21 @@ void VoodooI2CGoodixEventDriver::reportTouches(struct Touch touches[], int numTo
292303 }
293304
294305 if (numTouches == 1 ) {
295- handleSingletouchInteraction (touches[0 ], stylusButton1, stylusButton2);
306+ // Block single touch interactions until fingers have lifted after a multitouch interaction
307+ if (!isMultitouch) {
308+ handleSingletouchInteraction (touches[0 ], stylusButton1, stylusButton2);
309+ }
310+ else {
311+ #ifdef GOODIX_EVENT_DRIVER_DEBUG
312+ IOLog (" %s::Blocking phantom single touch interaction\n " , getName ());
313+ #endif
314+ }
296315 }
297316 else {
317+ // Cancel our outstanding click, we're multitouching
318+ this ->clickTimerSource ->cancelTimeout ();
319+
320+ isMultitouch = true ;
298321 handleMultitouchInteraction (touches, numTouches);
299322 }
300323}
0 commit comments