Skip to main content

Module pointer_backend

Module pointer_backend 

Source
Expand description

The seam between an OS input backend and Teksilo’s pointer vocabulary.

Everything above this module speaks PointerSample / ScrollSample / GestureEvent. Everything below it speaks whatever the window system speaks. PointerBackend is the one door between the two, and BackendCaps is the honest declaration of what the backend on the other side can and cannot report.

§Why a trait rather than a function

Three reasons, in the order they will bite:

  1. The winit 0.31 upgrade. winit 0.30 models touch as WindowEvent::Touch { id: u64, phase: TouchPhase, force, .. }; 0.31 replaces it with a unified pointer API (PointerKind, PointerSource, FingerId, the TabletTool* family). That is a rewrite of one implementation of this trait, not of the framework.
  2. Testing without an OS. The conformance suite (tests/backend_conformance.rs) drives recorded event vectors through this trait and checks six invariants. A future backend earns its trust by passing the same suite.
  3. Honesty about capability. A consumer that must know whether cancels are reported — or whether a finger can drag the window — should ask, not guess from cfg!(target_os = ...). BackendCaps is that answer, and every false in it is a documented platform fact rather than a to-do.

Reference: docs/touch-and-pen.md, “Platform capabilities”.

Structs§

BackendCaps
What a backend can actually report.

Enums§

BackendEvent
One OS packet on its way into PointerBackend::translate.
InputSample
One translated input sample, ready to enter a widget tree.
PlatformKind
Which OS a BackendCaps row describes.
SoftKeyboardSupport
How a platform can be asked to raise the on-screen keyboard.

Traits§

PointerBackend
Turns OS packets into InputSamples.