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 /// Monotonic window ID allocator.
43 #[get(pub(crate), type(copy))]
44 #[get_mut(pub(crate))]
45 #[set(pub(crate))]
46 pub(crate) next_id: u64,
47 /// Active simulated windows indexed by `WindowId`.
48 pub(crate) windows: HashMap<WindowId, HeadlessWindowRecord>,
49 /// Injected event queue drained on `poll_events()`.
50 pub(crate) pending_events: Vec<WindowEvent>,
51 /// In-memory clipboard storage.
52 #[get(skip)]
53 pub(crate) clipboard: Option<String>,
54}