pub struct HeadlessWindow { /* private fields */ }Expand description
The one canonical offscreen window marker. It implements platform_core::Window, so a single type
satisfies both the renderer bound (which needs only the raw-window-handle traits) and the platform bound
(Window). Its handles are always HandleError::Unavailable — there is no surface — so a renderer built
against it must use its new_headless constructor, and AppHandler detects the unavailable handle to
build an offscreen renderer. request_redraw is a no-op: crate::HeadlessPlatform drives frames
explicitly rather than through a windowing system’s redraw queue.
This replaces the ad-hoc HeadlessWindow that lived in renderer-hardware and the per-test struct Fake;
markers that renderer tests each defined for themselves.
Implementations§
Source§impl HeadlessWindow
impl HeadlessWindow
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
A logical width×height offscreen surface at scale 1.0 reporting no OS light/dark preference.
Sourcepub fn with_options(
width: u32,
height: u32,
scale_factor: f64,
prefers_dark: Option<bool>,
) -> Self
pub fn with_options( width: u32, height: u32, scale_factor: f64, prefers_dark: Option<bool>, ) -> Self
Full control over the reported Window::scale_factor and Window::prefers_dark.
Trait Implementations§
Source§impl Clone for HeadlessWindow
impl Clone for HeadlessWindow
Source§fn clone(&self) -> HeadlessWindow
fn clone(&self) -> HeadlessWindow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl HasDisplayHandle for HeadlessWindow
impl HasDisplayHandle for HeadlessWindow
Source§fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
Source§impl HasWindowHandle for HeadlessWindow
impl HasWindowHandle for HeadlessWindow
Source§fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Source§impl Window for HeadlessWindow
impl Window for HeadlessWindow
fn width(&self) -> u32
fn height(&self) -> u32
fn request_redraw(&self)
fn scale_factor(&self) -> f64
Source§fn prefers_dark(&self) -> Option<bool>
fn prefers_dark(&self) -> Option<bool>
Some(true) = prefer dark. None when
undetectable (e.g. X11, or a compositor without the settings portal). Defaults to None.Source§fn is_offscreen(&self) -> bool
fn is_offscreen(&self) -> bool
false (an on-screen window).Source§fn drag_window(&self)
fn drag_window(&self)
Source§fn set_minimized(&self, _minimized: bool)
fn set_minimized(&self, _minimized: bool)
true) or restores (false) the window. No-op where unsupported.Source§fn set_maximized(&self, _maximized: bool)
fn set_maximized(&self, _maximized: bool)
true) or restores (false) the window. No-op where unsupported.Source§fn is_maximized(&self) -> bool
fn is_maximized(&self) -> bool
false where unsupported.Source§fn focus_window(&self)
fn focus_window(&self)
Auto Trait Implementations§
impl Freeze for HeadlessWindow
impl RefUnwindSafe for HeadlessWindow
impl Send for HeadlessWindow
impl Sync for HeadlessWindow
impl Unpin for HeadlessWindow
impl UnsafeUnpin for HeadlessWindow
impl UnwindSafe for HeadlessWindow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
Source§fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
Use HasDisplayHandle instead
Source§impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
Source§fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
Use HasWindowHandle instead