Skip to main content

Crate damascene_winit

Crate damascene_winit 

Source
Expand description

Pure winit → damascene input mappers.

Leaf translation functions with no host state — a custom ApplicationHandler calls these from its own window_event to produce the values damascene_core’s runtime input methods expect. They are render-backend-neutral: the in-tree wgpu host routes every event through these same functions, and vulkano / ash / out-of-tree hosts use them without pulling in any GPU stack (this crate depends on damascene-core and winit only — see issue #121).

Since the three-facet key model (#114) the mappings are total tables over the W3C named-key and physical-code vocabularies; the tests here assert that coverage against damascene_core’s ALL consts, so a new core variant fails this crate’s tests instead of silently degrading to Unidentified in every host.

Note the winit version coupling: these signatures take this crate’s winit types, so a host must use the same winit major version (re-check Cargo.toml on upgrades).

Functions§

key_modifiers
Translate winit’s ModifiersState to damascene KeyModifiers.
map_key
Translate a winit logical Key to a damascene LogicalKey — the key’s layout-dependent meaning.
map_physical
Translate a winit PhysicalKey to a damascene PhysicalKey — the layout-independent board position (W3C code).
pointer_button
Translate a winit MouseButton to a damascene PointerButton.
touch_pressure
Normalize a winit touch Force to the [0, 1] pressure value Pointer::with_pressure expects. None in, None out — winit reports no force on platforms/devices without a pressure sensor.
winit_cursor
Translate a damascene Cursor to winit’s CursorIcon. The damascene enum is a subset of winit’s so this stays a 1:1 map; the wildcard arm is a forward-compat safety net (damascene’s Cursor is non_exhaustive — add a new variant in core, add the matching arm here, otherwise it falls back to the platform default; the test against Cursor::ALL catches the gap).