Windows Mobile 6.5 Gesture API for Developers

Windows Mobile 6.5 marked a significant shift toward touch-friendly user interfaces by introducing the native Gesture Application Programming Interface (Gesture API). This article explores the gesture framework provided to software developers in Windows Mobile 6.5, detailing its architecture, the core window messages it introduced, and how it enabled modern touch interactions such as panning and flicking on legacy mobile hardware.

The Windows Mobile 6.5 Gesture API

To modernize the platform and compete with emerging capacitive touchscreen devices, Microsoft exposed the Gesture API (commonly referred to simply as the Touch Gestures framework) in Windows Mobile 6.5. Prior to this release, developers had to manually track low-level touch events through standard mouse messages (WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP). The Gesture API abstracted these raw coordinates into standardized touch interactions.

Core Architecture and Messages

The framework operated on top of the traditional Win32 messaging system by intercepting touch input at the operating system level and translating it into a dedicated gesture message: WM_GESTURE.

When a user interacted with the screen, the system packaged the touch dynamics and dispatched them through this message. Developers interacted with the framework using several key components:

  • WM_GESTURE Message: Delivered gesture events to the target window procedure, carrying information about the type and state of the gesture.
  • GESTUREINFO Structure: Retrieved using the GetGestureInfo function, this structure provided detailed telemetry, including gesture type, starting points, current coordinates, and velocity.
  • Gestures Supported: The API recognized specific user actions, primarily:
    • Pan: Continuous movement of a finger across the screen.
    • Flick: Quick, directional swipes often used for fast scrolling or navigation.
    • Hold: A sustained press on a specific area.
    • Select: A discrete tap.

The Built-In Physics Engine

Beyond simple recognition, Windows Mobile 6.5 integrated a native physics engine alongside the Gesture API. This allowed lists and scrollable regions to exhibit inertial movement, deceleration, and the characteristic "bounce" animation when reaching the boundary of a scrollable view. Developers could either let the operating system automatically handle these physics animations for standard controls or extract velocity data from flick gestures to drive custom animation loops.

Implementation Across Native and Managed Code

The Gesture API was implemented natively in C++. Native Win32 and MFC developers could directly handle WM_GESTURE in their message loops and call functions like GetGestureInfo and CloseGestureInfoHandle to manage memory.

For developers utilizing the .NET Compact Framework (C# and VB.NET), Microsoft did not provide direct, managed runtime wrappers out of the box. Consequently, managed developers integrated with the gesture framework by subclassing control message loops via Platform Invoke (P/Invoke) to intercept the WM_GESTURE message directly.