Touchpad RFP

This proposal seeks a developer capable of working with the OS X Touch API to create a tool that can record how trackpad input corresponds to cursor movement in OS X. The proposal calls for two deliverables: a data collection utility, and a trackpad visualization utility.


Note that, in the document below, I refer to "trackpad" when I'm discussing the OS X touchpad specifically, since it matches the terminology used by Apple itself. When referring to Linux touchpads, I'll use the term "touchpad."


link1. Data collection utility

The structure to hold this data should be of the form:


class touchTimeslice {
  integer time; # Milliseconds since recording started
  Touch touches[]; # Array of Touch objects (spec below) active
  Point cursorPos; # Cursor position in active window
  Point cursorDelta; # Cursor delta (=movement), difference in cursor position since last our last timeslice
  Point scrollPos; # Scroll position in active window
  Point scrollDelta; # Scroll delta (=movement), difference in scroll position since last our last timeslice 
  Gesture gestures[]; # Gestures detected from active Touch objects
}


Each of the Touch objects would include all relevant data from Apple's NSTouch class, plus a couple other that we can calculate from theirs. Something like this:


class Touch {
  integer touchPhase; # Implements all touches from https://developer.apple.com/documentation/appkit/nstouch/phase
  Point normalizedPosition; # https://developer.apple.com/documentation/appkit/nstouch/1534031-normalizedposition
  Point deltaPosition; # Difference in this touch's position since last timeslice
  bool isResting;
}


So, for example, one touchTimeslice might look like:


touchTimeslice(
  time: 10, # Milliseconds since recording began
  touches: [ 
    Touch(touchPhase: "begin", normalizedPosition: (0.001, 0.383), deltaPosition: (0.0, 0.0), radius: 12, isResting: true), # One depressed finger
    Touch(touchPhase: "moved", normalizedPosition: (0.5, 0.56), deltaPosition: (-0.1, -0.03), radius: 3, isResting: false) # Second depressed finger
  ], 
  cursorPos: (500, 500), # Cursor position within active window
  cursorDelta: (-5, -3), # Cursor delta within active window
  scrollPos: (0, 0), # Scroll position within active window
  scrollDelta: (0, 0),
  gestures_active: null,
]


For maximum portability, the output of the data collection utility should be stored in JSON within a text file.


link2. Trackpad visualization utility

This tool supplements the data collection utility, allowing its work to be visualized in real time. It ought to look something like this:


Where the following are present:

  1. Each existent pixel of the Mac trackpad is represented by a white dot

  1. Each Touch object (area where a finger is touching trackpad) is illustrated by applying a color to the pixels that are depressed as a part of the touch

  1. Current cursor position and scroll position

  1. Delta (difference incurred during last render cycle) of cursor position and scroll position


linkPrior art