Skip to content

Commit

Permalink
Fix two-finger tap not working
Browse files Browse the repository at this point in the history
  • Loading branch information
ASHIJANKEN committed Jan 3, 2022
1 parent d047886 commit 6da864a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions MiddleClick/Controller.m
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,25 @@ int touchCallback(int device, Finger* data, int nFingers, double timestamp,
}

if (nFingers == fingersQua) {
Finger* f1 = &data[0];
Finger* f2 = &data[1];
Finger* f3 = &data[2];

if (maybeMiddleClick == YES) {
middleclickX = (f1->normalized.pos.x + f2->normalized.pos.x + f3->normalized.pos.x);
middleclickY = (f1->normalized.pos.y + f2->normalized.pos.y + f3->normalized.pos.y);
for (int i = 0; i < fingersQua; i++)
{
mtPoint pos = ((Finger *)&data[i])->normalized.pos;
middleclickX += pos.x;
middleclickY += pos.y;
}
middleclickX2 = middleclickX;
middleclickY2 = middleclickY;
maybeMiddleClick = NO;
} else {
middleclickX2 = (f1->normalized.pos.x + f2->normalized.pos.x + f3->normalized.pos.x);
middleclickY2 = (f1->normalized.pos.y + f2->normalized.pos.y + f3->normalized.pos.y);
middleclickX2 = 0.0f;
middleclickY2 = 0.0f;
for (int i = 0; i < fingersQua; i++)
{
mtPoint pos = ((Finger *)&data[i])->normalized.pos;
middleclickX2 += pos.x;
middleclickY2 += pos.y;
}
}
}
}
Expand Down

0 comments on commit 6da864a

Please sign in to comment.