Skip to main content

incular_runtime/
transient_presentation.rs

1use incular_config::{TransientPresentation, TransientRole};
2use incular_widgets::TransientSurfaceId;
3
4/// Presentation actually selected by the native adapter for one retained
5/// transient during its current visible lifetime.
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum ResolvedTransientPresentation {
8    Native,
9    Overlay,
10}
11
12/// Why an `Auto` transient is currently using the owning view's overlay.
13///
14/// These categories are deliberately renderer/platform neutral. Native error
15/// objects remain at the adapter boundary; diagnostics only need a stable
16/// explanation of the fallback decision.
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18pub enum TransientFallbackReason {
19    /// Application code explicitly requested `TransientPresentation::Overlay`.
20    RequestedOverlay,
21    /// The active backend/session does not support this transient role.
22    NativeUnsupported,
23    /// Native host creation, attachment, presentation, or rendering failed.
24    NativeHostUnavailable,
25    /// The native swapchain cannot preserve required transparent pixels for
26    /// this retained popup. Falling back avoids visually corrupt opaque corners.
27    SurfaceTransparencyRequired,
28}
29
30/// Read-only resolved state for one visible semantic transient.
31#[derive(Clone, Copy, Debug, PartialEq, Eq)]
32pub struct TransientPresentationResolution {
33    pub id: TransientSurfaceId,
34    pub role: TransientRole,
35    pub requested: TransientPresentation,
36    pub resolved: ResolvedTransientPresentation,
37    pub fallback_reason: Option<TransientFallbackReason>,
38}