euv_core/platform/info/struct.rs
1use super::*;
2
3/// Normalized hardware and OS capability flags reported by every platform backend.
4#[derive(Clone, Copy, Debug, Default, Eq, Getter, Hash, PartialEq)]
5pub struct PlatformCapabilities {
6 /// Supports opening and managing multiple independent OS windows simultaneously.
7 #[get(type(copy))]
8 pub(crate) multi_window: bool,
9 /// Supports hover pointer tracking (mouse, trackpad, Apple Pencil hover).
10 #[get(type(copy))]
11 pub(crate) hover_pointer: bool,
12 /// Supports multi-touch gestures.
13 #[get(type(copy))]
14 pub(crate) touch: bool,
15 /// Supports stylus / Apple Pencil pressure input.
16 #[get(type(copy))]
17 pub(crate) stylus: bool,
18 /// Supports physical hardware keyboard input.
19 #[get(type(copy))]
20 pub(crate) hardware_keyboard: bool,
21 /// Reports non-trivial OS safe-area cutouts or gesture bars.
22 #[get(type(copy))]
23 pub(crate) safe_area_insets: bool,
24 /// Supports native GPU hardware acceleration (Metal / Vulkan / D3D / WebGPU / WebGL2).
25 #[get(type(copy))]
26 pub(crate) hardware_gpu: bool,
27 /// Supports direct CPU framebuffer presentation.
28 #[get(type(copy))]
29 pub(crate) software_blit: bool,
30 /// Supports native system clipboard read/write.
31 #[get(type(copy))]
32 pub(crate) clipboard: bool,
33 /// Supports native IME / soft keyboard composition.
34 #[get(type(copy))]
35 pub(crate) ime: bool,
36 /// Supports Apple Dynamic Island hardware cutout presentation (`iOS`).
37 #[get(type(copy))]
38 pub(crate) dynamic_island: bool,
39 /// Supports native Live Activities / ongoing live status surfaces (`iOS`, `iPadOS`, `Android`).
40 #[get(type(copy))]
41 pub(crate) live_activities: bool,
42 /// Supports desktop system tray or menu bar status icons (`macOS`, `Windows`, `Linux`).
43 #[get(type(copy))]
44 pub(crate) system_tray: bool,
45 /// Supports OS biometric authentication (Face ID, Touch ID, BiometricPrompt, Windows Hello, Passkeys).
46 #[get(type(copy))]
47 pub(crate) biometrics: bool,
48 /// Supports tactile haptic feedback pulses.
49 #[get(type(copy))]
50 pub(crate) haptics: bool,
51 /// Supports custom URL protocol / deep link handler registration.
52 #[get(type(copy))]
53 pub(crate) protocol_handler: bool,
54 /// Supports native OS accessibility bridge (NSAccessibility, UIAccessibility, UIA, AT-SPI2, Android, ARIA).
55 #[get(type(copy))]
56 pub(crate) accessibility_bridge: bool,
57 /// Supports rotary crown or rotating bezel detent input (smartwatches and automotive dials).
58 #[get(type(copy))]
59 pub(crate) rotary_input: bool,
60 /// Supports Always-On Display (AOD) low-power ambient lifecycle transitions.
61 #[get(type(copy))]
62 pub(crate) always_on_display: bool,
63 /// Host container displays floating capsule navigation chrome requiring inset clearance.
64 #[get(type(copy))]
65 pub(crate) capsule_chrome: bool,
66 /// Renders semantic UI into terminal character cells or plain UTF-8 stdout streams.
67 #[get(type(copy))]
68 pub(crate) terminal_cells: bool,
69 /// Supports multi-device distributed continuation or atomic service handoff.
70 #[get(type(copy))]
71 pub(crate) distributed_continuation: bool,
72 /// Supports sandboxed persistent key-value local storage.
73 #[get(type(copy))]
74 pub(crate) local_storage: bool,
75}
76
77/// Hardware display mode descriptor reported by Android `Display.Mode` and desktop monitors.
78#[derive(Clone, Copy, Debug, Default, Getter, New, PartialEq)]
79pub struct DisplayModeInfo {
80 /// OS display mode identifier (e.g. Android `Display.Mode.getModeId()`).
81 #[get(pub(crate), type(copy))]
82 pub(crate) mode_id: i32,
83 /// Physical mode width in pixels.
84 #[get(pub(crate), type(copy))]
85 pub(crate) physical_width: u32,
86 /// Physical mode height in pixels.
87 #[get(pub(crate), type(copy))]
88 pub(crate) physical_height: u32,
89 /// Nominal hardware refresh rate in Hertz (e.g. `60.0`, `90.0`, `120.0`, `144.0`, `240.0`).
90 #[get(pub(crate), type(copy))]
91 pub(crate) refresh_rate_hz: f32,
92}
93
94/// Resolved VSync frame pacing parameters for high-refresh displays (`CADisplayLink`, `Choreographer`, desktop timers).
95#[derive(Clone, Copy, Debug, Default, Getter, New, PartialEq)]
96pub struct FramePacingConfig {
97 /// Minimum adaptive refresh rate in Hertz (`CAFrameRateRange.minimum`).
98 #[get(pub(crate), type(copy))]
99 pub(crate) min_hz: f32,
100 /// Maximum adaptive refresh rate in Hertz (`CAFrameRateRange.maximum`).
101 #[get(pub(crate), type(copy))]
102 pub(crate) max_hz: f32,
103 /// Preferred target refresh rate in Hertz (`CAFrameRateRange.preferred` / `Surface.setFrameRate`).
104 #[get(pub(crate), type(copy))]
105 pub(crate) preferred_hz: f32,
106 /// Nominal frame duration in seconds (`1.0 / preferred_hz`).
107 #[get(pub(crate), type(copy))]
108 pub(crate) frame_interval_secs: f32,
109 /// Nominal frame duration in nanoseconds (`round(1e9 / preferred_hz)`).
110 #[get(pub(crate), type(copy))]
111 pub(crate) frame_interval_nanos: u64,
112}
113
114/// Platform-side active touch contact tracker normalizing Android `MotionEvent` and iOS `UITouch` cancellation lifecycles.
115#[derive(Clone, Data, Debug, Default, PartialEq)]
116pub struct TouchPointerTracker {
117 /// Ordered set of currently live mapped pointer contact identifiers (`>= 1`).
118 #[get(pub(crate))]
119 #[get_mut(pub(crate))]
120 #[set(pub(crate))]
121 pub(crate) active_pointers: Vec<u64>,
122}
123
124/// Generation-stamped mobile host session lifecycle coordinator guarding same-process exit and re-entry races.
125#[derive(Clone, Data, Debug, Default, PartialEq)]
126pub struct MobileSessionLifecycle {
127 /// Monotonic process-wide session generation incremented on every fresh activity or scene launch.
128 #[get(pub(crate), type(copy))]
129 #[set(pub(crate))]
130 pub(crate) session_generation: u64,
131 /// Identifier of the currently active host activity or scene owning native bridge callbacks.
132 #[get(pub(crate), type(copy))]
133 #[set(pub(crate))]
134 pub(crate) active_owner_id: u64,
135 /// Monotonic frame-loop generation preventing duplicate `Choreographer` or `CADisplayLink` callbacks.
136 #[get(pub(crate), type(copy))]
137 #[set(pub(crate))]
138 pub(crate) loop_generation: u64,
139 /// Whether the active session currently has an attached native rendering surface.
140 #[get(pub(crate), type(copy))]
141 #[set(pub(crate))]
142 pub(crate) surface_attached: bool,
143 /// Whether the active session's VSync render loop is running.
144 #[get(pub(crate), type(copy))]
145 #[set(pub(crate))]
146 pub(crate) loop_running: bool,
147 /// Whether the active session's runtime `App` is still open and interactive.
148 #[get(pub(crate), type(copy))]
149 #[set(pub(crate))]
150 pub(crate) app_running: bool,
151 /// Whether the active session is currently background-frozen.
152 #[get(pub(crate), type(copy))]
153 #[set(pub(crate))]
154 pub(crate) background_frozen: bool,
155 /// Whether the active session received a terminal exit or `Terminate` signal.
156 #[get(pub(crate), type(copy))]
157 #[set(pub(crate))]
158 pub(crate) terminated: bool,
159 /// Active touch contact tracker cleared automatically on pause, focus loss, and surface teardown.
160 #[get(pub(crate))]
161 #[get_mut(pub(crate))]
162 #[set(pub(crate))]
163 pub(crate) touch_tracker: TouchPointerTracker,
164}