Skip to main content

WindowsBackend

Struct WindowsBackend 

Source
pub struct WindowsBackend { /* private fields */ }
Expand description

Windows-native DesktopBackend driving Explorer’s desktop folder view.

Implementations§

Source§

impl WindowsBackend

Source

pub fn new() -> Self

Construct a new backend. COM is initialised lazily — no work is done until the first trait method call. Never fails; errors surface at that first call instead.

Also opts the current process into Per-Monitor V2 DPI awareness (idempotent; failure is silently accepted for processes whose awareness was already fixed by manifest). This MUST run before any DPI-sensitive Shell call — in particular before Self::list_monitors and Self::begin_overlay_session — otherwise GetDpiForMonitor and SPI_GETICONMETRICS return virtualised 96-DPI values and the overlay renders icons + labels at ~1/scale of their real physical size on high-DPI displays.

Trait Implementations§

Source§

impl Default for WindowsBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl DesktopBackend for WindowsBackend

Source§

fn list_icons(&mut self) -> Result<Vec<IconSnapshot>, DesktopError>

Source§

fn get_flags(&mut self) -> Result<u32, DesktopError>

Source§

fn apply_flags(&mut self, mask: u32, values: u32) -> Result<(), DesktopError>

Source§

fn set_positions( &mut self, moves: &[(IconId, Point)], ) -> Result<Vec<IconId>, DesktopError>

Commit a batch of (id, new_position) moves. Returns the ids the backend could not resolve (i.e. icons that vanished or were never on the desktop).
Source§

fn list_monitors(&mut self) -> Result<Vec<MonitorInfo>, DesktopError>

Enumerate every connected display. Bounds are reported in the same virtual-screen coordinate system used by list_icons and set_positions.
Source§

fn desktop_info( &mut self, icons: &[IconSnapshot], ) -> Result<DesktopInfo, DesktopError>

Query live display/grid metrics using the worker’s current icon snapshot. Must not reposition icons or change folder flags.
Source§

fn begin_overlay_session( &mut self, plans: &[IconRenderPlan], render_options: OverlayRenderOptions, ) -> Result<(), DesktopError>

Prepare an overlay animation session covering the icons in plans. Read more
Source§

fn commit_overlay_frame( &mut self, positions: &[(IconId, Point)], ) -> Result<(), DesktopError>

Update the overlay’s rendered icon positions to positions. Read more
Source§

fn commit_visual_frame( &mut self, frame: &[IconFrame], ) -> Result<(), DesktopError>

Commit positions and visual clocks together. Non-GPU backends ignore visuals.
Source§

fn discard_overlay_session(&mut self)

Discard a prepared, never-started session without touching Shell positions.
Source§

fn validate_prepared_session(&mut self) -> Result<(), DesktopError>

Reject a prepared snapshot invalidated by environment changes, before any Shell writes.
Source§

fn set_real_icons_visible(&mut self, visible: bool) -> Result<(), DesktopError>

Source§

fn poll_overlay_session(&mut self) -> Result<(), DesktopError>

Source§

fn finalize_overlay_session( &mut self, final_positions: &[(IconId, Point)], ) -> Result<FinalCommitOutcome, DesktopError>

End the animation session and commit the final positions to the Shell. Read more
Source§

fn prepare_scene_renderer( &mut self, canvas: Canvas, plans: &[IconRenderPlan], options: OverlayRenderOptions, ) -> Result<Box<dyn SceneRenderer>, DesktopError>

Source§

fn capture_overlay( &mut self, seconds: f64, ) -> Result<CapturedFrame, DesktopError>

Source§

fn render_overlay_snapshot( &mut self, width_px: u32, height_px: u32, dpi_scale: f32, positions: &[(IconId, Point)], render_options: OverlayRenderOptions, ) -> Result<SnapshotFrame, DesktopError>

Render one frame of the overlay off-screen and return the raw pixels — never touches an HWND, DirectComposition target, or the real desktop. Safe to call at any time, including while a begin_overlay_session is active on another animation. Read more
Source§

impl Drop for WindowsBackend

Source§

fn drop(&mut self)

Best-effort cleanup for the “worker thread panicked mid- animation” case. Dropping while the overlay is still Live means the normal finalize_overlay_session path was skipped; mirroring it here keeps the desktop from being left with hidden icons after a panic.

The body is wrapped in catch_unwind because this runs during unwinding: restore_real_icons makes a COM call, and a panic inside a Drop that is itself unwinding aborts the process, skipping the very cleanup this impl exists to perform.

This does not cover abort() or TerminateProcess, which don’t run Drop. Startup cleanup in begin_overlay_session handles those.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for WindowsBackend

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more