Expand description
Runtime hint describing the user’s primary input device.
Distinct from crate::platform::Platform (which tracks the OS family
for shortcut labels — Cmd vs. Ctrl) because a Mac user with a
touchscreen MacBook and an iPad user both run Platform::MacOS but
need very different text-entry experiences.
The input profile drives features that should only exist on mobile touch devices:
- The agg-gui on-screen software keyboard
(
crate::widgets::on_screen_keyboard) - Hit-target padding around small interactive widgets (future)
- Long-press gesture timing (future)
Native builds default to InputProfile::Desktop. WASM hosts call
set_input_profile after sniffing navigator.userAgent +
matchMedia("(pointer: coarse)") so the agg-gui-side mobile features
activate. The host can also call [platform_from_name] /
set_platform so shortcut labels match
the user’s keyboard while the on-screen keyboard mimics their phone OS.
Enums§
- Input
Profile - Where keyboard / pointer events originate and how text entry should behave.
Functions§
- current_
input_ profile - Read the global input profile.
- input_
profile_ from_ hint - Parse a coarse browser identifier (“iPhone”, “iPad”, “Android”, …)
into an
InputProfile. Defaults toInputProfile::Desktopso a non-matching string (any desktop UA) keeps mobile features disabled. - is_
mobile_ touch - Convenience: detect mobile-touch from current profile.
- set_
input_ profile - Replace the global input profile. Call once at startup from the platform shell after detecting the device, and at most once more if the device changes (e.g. a tablet docked into a desktop mode).