From 79e6af2c92f5b3ce62372acb5a9d3fce8ac1db2a Mon Sep 17 00:00:00 2001 From: Emmanuel Youssef Date: Fri, 24 Jul 2026 17:17:47 +0200 Subject: [PATCH] Treat ToTouch state as an active contact --- AmtPtpDeviceUsbUm/InputInterrupt.c | 5 ++++- AmtPtpHidFilter/Input.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/AmtPtpDeviceUsbUm/InputInterrupt.c b/AmtPtpDeviceUsbUm/InputInterrupt.c index 2429e6c..b2cb3c8 100644 --- a/AmtPtpDeviceUsbUm/InputInterrupt.c +++ b/AmtPtpDeviceUsbUm/InputInterrupt.c @@ -520,7 +520,10 @@ AmtPtpServiceTouchInputInterruptType5( // 0x4 = Contact/Valid // I've gotten 0x6 if I press on the trackpad and then keep my finger close // Note: These values come from my MBP9,2. These also are valid on my MT2 - PtpReport.Contacts[i].TipSwitch = (f->State & 0x4) && (DeviceContext->IgnoreNearFingers == FALSE ? TRUE : !(f->State & 0x2)); + // State 0x3 is the transition into touch (ToTouch), so it must already be + // reported as an active contact. Otherwise a click in that frame may be + // classified by Windows as a one-finger left click. + PtpReport.Contacts[i].TipSwitch = (f->State == 0x3) || ((f->State & 0x4) && (DeviceContext->IgnoreNearFingers == FALSE ? TRUE : !(f->State & 0x2))); // The Microsoft spec says reject any input larger than 25mm. This is not ideal // for Magic Trackpad 2 - so we raised the threshold a bit higher. diff --git a/AmtPtpHidFilter/Input.c b/AmtPtpHidFilter/Input.c index 325b96f..153f474 100644 --- a/AmtPtpHidFilter/Input.c +++ b/AmtPtpHidFilter/Input.c @@ -196,7 +196,10 @@ PtpFilterInputParseMT2Report( // 0x4 = Contact/Valid // I've gotten 0x6 if I press on the trackpad and then keep my finger close // Note: These values come from my MBP9,2. These also are valid on my MT2 - ptpOutputReport.Contacts[i].TipSwitch = (f->State & 0x4) && (driverContext->IgnoreNearFingers == FALSE ? TRUE : !(f->State & 0x2)); + // State 0x3 is the transition into touch (ToTouch), so it must already be + // reported as an active contact. Otherwise a click in that frame may be + // classified by Windows as a one-finger left click. + ptpOutputReport.Contacts[i].TipSwitch = (f->State == 0x3) || ((f->State & 0x4) && (driverContext->IgnoreNearFingers == FALSE ? TRUE : !(f->State & 0x2))); // The Microsoft spec says reject any input larger than 25mm. This is not ideal // for Magic Trackpad 2 - so we raised the threshold a bit higher.