euv_core/platform/headless/struct.rs
1use super::*;
2
3/// Simulated window record held by `HeadlessPlatform`.
4#[derive(Clone, Data, Debug)]
5pub struct HeadlessWindowRecord {
6 /// Current window configuration.
7 pub(crate) config: WindowConfig,
8 /// Current live window metrics and state.
9 #[get(type(copy))]
10 pub(crate) state: WindowState,
11 /// Active cursor icon hint.
12 #[get(type(copy))]
13 pub(crate) cursor: CursorIcon,
14 /// Last presented RGBA8 framebuffer snapshot.
15 pub(crate) last_frame: Framebuffer,
16 /// Count of frames presented to this window.
17 #[get(type(copy))]
18 pub(crate) present_count: u64,
19 /// Whether the system soft keyboard / IME is currently active for this window.
20 #[get(type(copy))]
21 pub(crate) ime_active: bool,
22 /// Logical screen rectangle of the active IME input anchor.
23 #[get(type(copy))]
24 pub(crate) ime_rect: Rect,
25}
26
27/// Deterministic offscreen platform backend available on all targets for CI and pixel-parity testing.
28#[derive(Clone, Data, Debug)]
29pub struct HeadlessPlatform {
30 /// Emulated platform identity (defaults to `PlatformKind::Headless`, can emulate any of the 7 targets).
31 #[get(type(copy))]
32 pub(crate) emulated_kind: PlatformKind,
33 /// Simulated DPI scale factor applied to newly created windows.
34 #[get(type(copy))]
35 pub(crate) scale_factor: f32,
36 /// Simulated safe-area insets applied to newly created windows.
37 #[get(type(copy))]
38 pub(crate) safe_area: SafeAreaInsets,
39 /// Simulated OS theme mode.
40 #[get(type(copy))]
41 pub(crate) theme: ThemeMode,
42 /// Simulated display refresh rate in Hertz (`60.0` default; supports `90.0`/`120.0`/`144.0`/`240.0` testing).
43 #[get(pub(crate), type(copy))]
44 #[get_mut(pub(crate))]
45 #[set(pub(crate))]
46 pub(crate) refresh_rate_hz: f32,
47 /// Monotonic window ID allocator.
48 #[get(pub(crate), type(copy))]
49 #[get_mut(pub(crate))]
50 #[set(pub(crate))]
51 pub(crate) next_id: u64,
52 /// Active simulated windows indexed by `WindowId`.
53 pub(crate) windows: HashMap<WindowId, HeadlessWindowRecord>,
54 /// Injected event queue drained on `poll_events()`.
55 pub(crate) pending_events: Vec<WindowEvent>,
56 /// In-memory clipboard storage.
57 #[get(skip)]
58 pub(crate) clipboard: Option<String>,
59 /// Whether the frame pump is currently paused for background freeze.
60 #[get(type(copy))]
61 pub(crate) pump_paused: bool,
62 /// Count of blocking `wait_for_events()` invocations recorded during background sleep.
63 #[get(type(copy))]
64 pub(crate) wait_calls: u64,
65}