-[NSEvent momentumPhase]
is the solution. So, the events generated from the trackpad between the beginGesture and endGesture events returns a value other than NSEventPhaseNone
for -[NSEvent phase]
and the trackpad events that are generated after the endGesture event returns a value other than NSEventPhaseNone
for -[NSEvent momentumPhase]
. The code is below,
- (void)scrollWheel:(NSEvent *)theEvent
{
if(([theEvent momentumPhase] != NSEventPhaseNone) || [theEvent phase] != NSEventPhaseNone))
{
//theEvent is from trackpad
}
else
{
//theEvent is from mouse
}
}