Skip to content

Commit

Permalink
fix for asus touchpad data #1
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvsk committed Nov 24, 2023
1 parent 313f1b6 commit 5a3fa3e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions TouchProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public CooldownDelay DragCooldownDelay
set => dragCooldownTimer.Interval = (double)value;
}

private RawInputDigitizerContact[]? bufferedContacts = null;
private RawInputDigitizerContact[] previousContacts;
private Point? previousCenterPoint;
int newContactsCount = 0;
Expand Down Expand Up @@ -96,6 +97,18 @@ public void Update(RawInputDigitizerData data)
.Where(c => c.IsButtonDown.GetValueOrDefault(false) && c.Kind == RawInputDigitizerContactKind.Finger)
.ToArray();

if (bufferedContacts != null)
{
newContacts = bufferedContacts.Concat(newContacts).ToArray();
bufferedContacts = null;
}

if (newContacts.Length < data.ContactsCount)
{
bufferedContacts = newContacts;
return;
}

newContactsCount = data.ContactsCount;
if (newContacts.Length == 0)
{
Expand Down

0 comments on commit 5a3fa3e

Please sign in to comment.