Skip to content

Touchpad

hifihedgehog edited this page May 26, 2026 · 11 revisions

Touchpad

Per-slot touchpad tuning: continuous output modes (mouse, virtual analog stick, D-pad) and the gesture stack (swipes, taps, longpress, pinch, rotate, shape templates). One physical touchpad in two slots carries two independent configurations.

Touchpad tab

The Touchpad tab appears on any slot whose assigned device exposes a touchpad surface: DualSense, DualSense Edge, DualShock 4, a Web Controller client in DS4 or touchpad-only mode, the on-screen Touchpad Overlay, or a Windows Precision Touchpad enumerated through the Devices page.


What lives on this tab

Five cards, top to bottom:

  1. Stick / D-Pad Output. Turn a touchpad finger into a virtual analog stick (anchor-relative) and/or a wedge-thresholded D-pad.
  2. Mouse Output. Per-axis sensitivity and invert for touchpad-finger → mouse X/Y on a Keyboard / Mouse virtual controller.
  3. Gesture Detection. Master enable, recognize mode (in-box / custom / both), and cooldown between fires.
  4. In-Box Gestures. Swipes (4-way / 8-way), radial zones, taps, longpress, two-finger swipes, pinch / spread, rotate, three / four / five finger gestures, in-box shape templates.
  5. Custom Gestures. The profile's saved custom shape templates plus a recorder dialog to capture new ones.

The first two are continuous output modes you bind in the Button and Axis Mappings table. The last three drive a per-tick gesture engine whose fires you bind the same way.

Defaults are off. Every feature toggle starts disabled. Open the tab, flip the master switch, then enable each gesture or output you actually want. Numeric thresholds (cooldown, swipe distance, tap time window, longpress duration, deadzones) keep tuned defaults so a feature works correctly the moment it's turned on.


Stick / D-Pad Output

Anchors where your finger first lands. Current position relative to that anchor drives the virtual stick X/Y and (optionally) latched D-pad direction bools.

Knob Default Effect
Enable Stick / D-Pad Output off Surfaces Touchpad N StickX, Touchpad N StickY, and the four Touchpad N DPad{Up/Down/Left/Right} descriptors in the mapping picker.
Max Radius (0..1) 0.30 Distance from anchor at which stick output saturates to ±1. Smaller = twitchier; larger = more travel. 0.30 means half the pad sweep in either direction gives full deflection.
Inner Deadzone (0..1) 0.02 Magnitude below this maps stick output to (0, 0). Prevents sub-millimeter finger drift from registering as slow stick input.
D-Pad Mode 4-Way Off skips D-pad output. 4-Way emits one cardinal at a time (90° wedges). 8-Way emits two cardinals on diagonals (matches physical D-pads reporting NE / NW / SE / SW).
D-Pad Activation (0..1) 0.15 Minimum distance from anchor for any D-pad direction to fire. Independent of the stick inner deadzone so the tactile D-pad snap dials separately from analog feel.

Bind Touchpad N StickX to a virtual stick X axis to use the surface as a thumbstick. Bind Touchpad N DPadUp to a face button to use it as a tap-pad.


Mouse Output

Tunes cursor speed when a touchpad finger is mapped to mouse X/Y on a Keyboard + Mouse virtual controller.

Knob Default Effect
Mouse Sensitivity X 1.0 Multiplier on horizontal touchpad → mouse delta. 1.0 is the calibrated baseline (a full horizontal pad sweep moves the cursor ~1920 pixels). Below 1.0 = slower cursor, above 1.0 = faster. Range 0.05..10.0.
Mouse Sensitivity Y 1.0 Same for vertical motion.
Invert Mouse X off Finger right moves the cursor left.
Invert Mouse Y off Finger down moves the cursor up.

Bind Touchpad N Finger 0 X to KBM Mouse X (and Y to Mouse Y) to use the surface as a trackpad. The KBM virtual controller produces real Windows mouse input. The cursor moves in any focused app, not just games that read controller mouse axes.


Gesture Detection

Master controls for the per-tick gesture recognizer.

Knob Default Effect
Enable Gestures off Master switch. Off skips the recognizer entirely for this slot.
Recognize Both In-Box Only runs the built-in catalog (swipes / taps / longpress / pinch / rotate / in-box shapes). Custom Only runs only the profile's saved custom shape templates. Both runs everything.
Cooldown (ms) 100 Minimum time between consecutive gesture fires from this pad. Prevents bounce-fire when a quick reverse motion would otherwise re-fire the opposite-direction swipe immediately.

In-Box Gestures

Every toggle here is off by default. Flip the ones you want.

Tier 1: single-finger fires. 4-way swipes (Up/Down/Left/Right) and 8-way diagonals (NE/NW/SE/SW). Radial zones (4 / 6 / 8 / 12 sectors with a configurable centre dead-zone). Tap, double-tap, triple-tap (with a configurable inter-tap gap). Long-press (configurable hold duration).

Tier 2: multi-finger. Two-finger swipes (with angular-tolerance gate to distinguish from pinch / spread). Pinch / spread (relative-distance threshold). Rotate (degrees-of-rotation threshold). Three / four / five-finger gestures on devices that support multi-touch deep enough. Windows PTP carries all five.

Tier 3: shape templates. Five built-in shapes (Circle, Square, Triangle, Z, Checkmark). Circle ships with separate clockwise and counter-clockwise bindings so the two directions can drive different mappings. The matcher is scale, position, and rotation invariant, so a small square in the corner matches the same shape as a large one in the centre. An adjustable threshold tunes strictness: lower = fewer false positives, higher = more matches.

Each gesture surfaces a descriptor in the mapping picker. Bind Touchpad N SwipeUp to a button to fire on swipe, Touchpad N PinchAxis to an analog axis to read the continuous pinch magnitude, etc.


Custom Gestures

Profile-scoped: captured custom gestures travel with whichever profile is active when they're recorded. Each gesture has a name, finger count, and the recorded finger path(s).

Click Record New Gesture to open the recorder dialog. The dialog mirrors the live touchpad surface. Trace your gesture, click Save, give it a name. The new gesture appears in the list and surfaces a Touchpad N Custom_<name> descriptor in the mapping picker.

A device whose CapType is Touchpad (PTP, web touchpad client, overlay) but isn't currently selected as the active mapping device still drives the recorder, so you can capture a gesture on the touchpad device while the slot's primary device is something else.


Per-slot architecture

The same physical touchpad in two slots carries two independent gesture engines. PadForge keys the gesture context by (slot, device, padIdx), ticks the recognizer separately per slot with that slot's own settings, and exposes a separate FiredGesturesThisFrame set to each slot's mapping evaluation.

Practical consequence: if you assign a DualSense to slot 0 with "4-way swipes ON" and to slot 1 with "4-way swipes OFF," a horizontal swipe fires Touchpad 0 SwipeRight only on slot 0's mapping rows. Slot 1's toggle truly disables 4-way for slot 1. It doesn't accidentally inherit slot 0's behavior. The same per-slot scoping applies to every Stick / D-pad / Mouse setting on this tab.

PTP system touchpads (laptop trackpads enumerated via Raw Input) don't have a physical click button, so the Touchpad N Click descriptor is omitted from their picker entries and their auto-map. DualSense / DS4 / web touchpad / overlay devices all expose Click.


Reset buttons

Every row carries a per-field Reset button (the small ✕ on the right). Each card carries a Reset All button in its header that restores the card's defaults in one click.


Algorithms and credits

PadForge's shape recognition uses two algorithms ported from public reference implementations under BSD 3-Clause:

  • $Q point-cloud recognizer. Vatavu, Anthony, Wobbrock, "$Q: A Super-Quick, Articulation-Invariant Stroke-Gesture Recognizer for Low-Resource Devices" (MobileHCI 2018). PadForge's ShapeRecognizer is a C# re-derivation of the canonical JavaScript reference (Copyright (c) 2018-2019 Nathan Magrofuoco, Jacob O. Wobbrock, Radu-Daniel Vatavu, Lisa Anthony).
  • Angular-margin matcher. PadForge's AngularMarginRecognizer adapts the per-segment angle-direction scoring from GestureSign's PointPatternAnalyzer (Copyright (c) 2016 TransposonY).

Both run on every single-finger shape gesture. PadForge keeps the higher-confidence match.


PTP reader (development)

Windows Precision Touchpad devices flow through PrecisionTouchpadReader rather than an SDL wrapper. The reader implements four spec-mandatory behaviors that together make 3-, 4-, and 5-finger taps reliable:

  • Tip-switch. Digitizer usage 0x42 is the authoritative "is this contact touching" signal. Lifted contacts arrive in one final report with tip-switch = 0; reading the bit and skipping those entries stops the lift-report from inflating the contact count.
  • Multi-report frame assembly. Certified PTP hardware caps each HID report at 2 contacts. A 5-finger frame arrives as three reports (2 + 2 + 1) with the total carried on the first report's contact-count usage. The reader accumulates contacts across fragments and only commits when the buffer reaches the expected total.
  • Stable slot assignment. Each frame buffer entry carries its HID contact ID. Commit-time slot assignment keeps existing IDs in their slots and assigns new IDs to free slots, so a low-slot finger lifting doesn't shift the rest of the contacts down and corrupt the engine-side per-slot paths.
  • Staleness clear. Missing WM_INPUT for the device for over 100 ms clears all contacts and the in-progress frame so an orphaned partial doesn't bleed into the next touch session.

Field-level reference: Engine Library.


See also

Clone this wiki locally