use super::*;
#[derive(Clone, Copy, Data, Debug, Eq, PartialEq)]
pub struct HostVisualEquivalenceGate {
#[get(type(copy))]
pub(crate) fonts_equivalent: bool,
#[get(type(copy))]
pub(crate) layout_equivalent: bool,
#[get(type(copy))]
pub(crate) color_equivalent: bool,
#[get(type(copy))]
pub(crate) aa_equivalent: bool,
#[get(type(copy))]
pub(crate) shadow_equivalent: bool,
#[get(type(copy))]
pub(crate) blur_equivalent: bool,
#[get(type(copy))]
pub(crate) visible_tiles_equivalent: bool,
#[get(type(copy))]
pub(crate) media_quality_equivalent: bool,
}
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct HostChannelCapabilities {
#[get(type(copy))]
pub(crate) host_name: &'static str,
pub(crate) supported_channels: Vec<HostRenderChannel>,
#[get(type(copy))]
pub(crate) preferred_channel: HostRenderChannel,
#[get(type(copy))]
pub(crate) visual_equivalence: HostVisualEquivalenceGate,
#[get(type(copy))]
pub(crate) simulated_profile: bool,
#[get(type(copy))]
pub(crate) direct_gpu_verified_on_device: bool,
}
#[derive(Clone, Copy, Data, Debug, Eq, PartialEq)]
pub struct HostChannelSelection {
#[get(type(copy))]
pub(crate) selected: HostRenderChannel,
#[get(type(copy))]
pub(crate) single_channel_locked: bool,
#[get(type(copy))]
pub(crate) probing_disabled: bool,
#[get(type(copy))]
pub(crate) visual_equivalence_passed: bool,
#[get(type(copy))]
pub(crate) simulated_profile: bool,
#[get(type(copy))]
pub(crate) direct_gpu_verified_on_device: bool,
}
#[repr(C)]
pub struct OhNativeWindow {
pub(crate) _private: [u8; 0],
}
#[repr(C)]
pub struct OhNativeXComponent {
pub(crate) _private: [u8; 0],
}
#[repr(C)]
pub struct OhNativeWindowBuffer {
pub(crate) _private: [u8; 0],
}
#[repr(C)]
pub struct OhNapiEnv {
pub(crate) _private: [u8; 0],
}
#[repr(C)]
pub struct OhNapiValue {
pub(crate) _private: [u8; 0],
}
#[repr(C)]
pub struct OhNativeVSync {
pub(crate) _private: [u8; 0],
}
#[cfg(target_env = "ohos")]
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub(crate) struct HarmonyPollFd {
pub(crate) fd: i32,
pub(crate) events: i16,
pub(crate) revents: i16,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct OhBufferHandle {
pub(crate) fd: i32,
pub(crate) width: i32,
pub(crate) stride: i32,
pub(crate) height: i32,
pub(crate) size: i32,
pub(crate) format: i32,
pub(crate) usage: u64,
pub(crate) vir_addr: usize,
pub(crate) phy_addr: u64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct OhRegionRect {
pub(crate) x: i32,
pub(crate) y: i32,
pub(crate) w: u32,
pub(crate) h: u32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct OhRegion {
pub(crate) rects: *const OhRegionRect,
pub(crate) rect_number: i32,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct OhNativeXComponentTouchPoint {
pub(crate) id: i32,
pub(crate) screen_x: f32,
pub(crate) screen_y: f32,
pub(crate) x: f32,
pub(crate) y: f32,
pub(crate) touch_type: i32,
pub(crate) size: f64,
pub(crate) force: f32,
pub(crate) time_stamp: i64,
pub(crate) is_pressed: bool,
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct OhNativeXComponentTouchEvent {
pub(crate) id: i32,
pub(crate) screen_x: f32,
pub(crate) screen_y: f32,
pub(crate) x: f32,
pub(crate) y: f32,
pub(crate) touch_type: i32,
pub(crate) size: f64,
pub(crate) force: f32,
pub(crate) device_id: i64,
pub(crate) time_stamp: i64,
pub(crate) touch_points: [OhNativeXComponentTouchPoint; 10],
pub(crate) num_points: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct OhNativeXComponentCallback {
pub(crate) on_surface_created:
Option<unsafe extern "C" fn(*mut OhNativeXComponent, *mut OhNativeWindow)>,
pub(crate) on_surface_changed:
Option<unsafe extern "C" fn(*mut OhNativeXComponent, *mut OhNativeWindow)>,
pub(crate) on_surface_destroyed:
Option<unsafe extern "C" fn(*mut OhNativeXComponent, *mut OhNativeWindow)>,
pub(crate) dispatch_touch_event:
Option<unsafe extern "C" fn(*mut OhNativeXComponent, *mut OhNativeWindow)>,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct HarmonyAvoidArea {
#[get(type(copy))]
pub(crate) top_px: u32,
#[get(type(copy))]
pub(crate) right_px: u32,
#[get(type(copy))]
pub(crate) bottom_px: u32,
#[get(type(copy))]
pub(crate) left_px: u32,
#[get(type(copy))]
pub(crate) keyboard_px: u32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct HarmonyDeviceProfile {
#[get(type(copy))]
pub(crate) device_type: HarmonyDeviceType,
#[get(type(copy))]
pub(crate) logical_width: u32,
#[get(type(copy))]
pub(crate) logical_height: u32,
#[get(type(copy))]
pub(crate) density: f32,
#[get(type(copy))]
pub(crate) refresh_rate_hz: f32,
#[get(type(copy))]
pub(crate) graphics_api: HarmonyGraphicsApi,
}
#[derive(Clone, Data, Debug)]
pub struct HarmonyWindowRecord {
pub(crate) config: WindowConfig,
#[get(type(copy))]
pub(crate) state: WindowState,
pub(crate) xcomponent_id: String,
#[get(type(copy))]
pub(crate) native_window: usize,
#[get(type(copy))]
pub(crate) xcomponent: usize,
#[get(type(copy))]
pub(crate) graphics_api: HarmonyGraphicsApi,
#[get(type(copy))]
pub(crate) surface_width: u32,
#[get(type(copy))]
pub(crate) surface_height: u32,
pub(crate) last_frame: Framebuffer,
#[get(type(copy))]
pub(crate) present_count: u64,
}
#[derive(Clone, Data, Debug)]
pub struct HarmonyPlatform {
#[get(type(copy))]
pub(crate) profile: HarmonyDeviceProfile,
#[get(type(copy))]
pub(crate) fold_state: HarmonyFoldState,
#[get(type(copy))]
pub(crate) attached_native_window: usize,
#[get(type(copy))]
pub(crate) attached_xcomponent: usize,
#[get(type(copy))]
pub(crate) safe_area: SafeAreaInsets,
pub(crate) lifecycle: MobileSessionLifecycle,
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) next_id: u64,
#[get(skip)]
pub(crate) primary_window: Option<WindowId>,
pub(crate) windows: HashMap<WindowId, HarmonyWindowRecord>,
pub(crate) pending_events: Vec<WindowEvent>,
#[get(skip)]
pub(crate) clipboard: Option<String>,
pub(crate) storage: HashMap<String, String>,
pub(crate) route_stack: Vec<String>,
#[get(type(copy))]
pub(crate) theme: ThemeMode,
#[get(type(copy))]
pub(crate) pump_paused: bool,
#[get(type(copy))]
pub(crate) capture_last_frame: bool,
#[get(type(copy))]
pub(crate) vsync_handle: usize,
#[get(type(copy))]
pub(crate) last_vsync_timestamp_ns: i64,
}