Skip to content

Commit 842490a

Browse files
driver: small change of behavior of the pointer lock code
1 parent 4bd42fc commit 842490a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

AmtPtpDeviceUsbUm/InputInterrupt.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,12 @@ AmtPtpServiceTouchInputInterruptType5(
533533
// BOOL valid_finger = f->Finger != 6;
534534
PtpReport.Contacts[i].Confidence = DeviceContext->PalmRejection == FALSE ? TRUE : f->Finger != 6; // valid_size && valid_finger;
535535

536+
#define UINT32_SET_MSB(v) ((UINT32)v | ((UINT32)1 << 31))
537+
536538
PPTP_REPORT_AUX prev_contact = NULL;
537539
if (
540+
DeviceContext->PrevPtpReportAux1.Id != UINT32_SET_MSB(f->Id) &&
541+
DeviceContext->PrevPtpReportAux2.Id != UINT32_SET_MSB(f->Id) &&
538542
(DeviceContext->IgnoreButtonFinger == FALSE ? TRUE : (!DeviceContext->PrevIsButtonClicked || !PtpReport.IsButtonClicked)) &&
539543
(DeviceContext->StopPressure == 0xffffffff ? TRUE : f->Pressure > DeviceContext->StopPressure) &&
540544
(DeviceContext->StopSize == 0xffffffff ? TRUE : f->Size > DeviceContext->StopSize)
@@ -556,27 +560,34 @@ AmtPtpServiceTouchInputInterruptType5(
556560
contact->Id = f->Id;
557561
contact->TipSwitch = PtpReport.Contacts[i].TipSwitch;
558562
}
559-
else
563+
else // lock the pointer:
560564
{
561565
size_t j;
562566
for (j = 0; j < 2; j++)
563567
{
564568
PPTP_REPORT_AUX contact = !j ? &DeviceContext->PrevPtpReportAux1 : &DeviceContext->PrevPtpReportAux2;
565569

566-
if (contact->Id == f->Id)
570+
if (contact->Id == f->Id || contact->Id == UINT32_SET_MSB(f->Id))
567571
{
568572
contact->TipSwitch = PtpReport.Contacts[i].TipSwitch;
569573

570574
if (contact->TipSwitch)
575+
{
571576
prev_contact = contact;
577+
contact->Id = UINT32_SET_MSB(contact->Id);
578+
}
572579
else
580+
{
573581
contact->Id = (UINT32)-1;
582+
}
574583
}
575584
}
576585
}
577586
PtpReport.Contacts[i].X = prev_contact ? prev_contact->X : (USHORT)x;
578587
PtpReport.Contacts[i].Y = prev_contact ? prev_contact->Y : (USHORT)y;
579588

589+
#undef UINT32_SET_MSB
590+
580591
//#ifdef INPUT_CONTENT_TRACE
581592
TraceEvents(
582593
TRACE_LEVEL_INFORMATION,

0 commit comments

Comments
 (0)