pub struct WindowsBackend { /* private fields */ }Expand description
Windows-native DesktopBackend driving Explorer’s desktop folder view.
Implementations§
Source§impl WindowsBackend
impl WindowsBackend
Sourcepub fn new() -> Self
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
impl Default for WindowsBackend
Source§impl DesktopBackend for WindowsBackend
impl DesktopBackend for WindowsBackend
fn list_icons(&mut self) -> Result<Vec<IconSnapshot>, DesktopError>
fn get_flags(&mut self) -> Result<u32, DesktopError>
fn apply_flags(&mut self, mask: u32, values: u32) -> Result<(), DesktopError>
Source§fn set_positions(
&mut self,
moves: &[(IconId, Point)],
) -> Result<Vec<IconId>, DesktopError>
fn set_positions( &mut self, moves: &[(IconId, Point)], ) -> Result<Vec<IconId>, DesktopError>
(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>
fn list_monitors(&mut self) -> Result<Vec<MonitorInfo>, DesktopError>
list_icons and
set_positions.Source§fn desktop_info(
&mut self,
icons: &[IconSnapshot],
) -> Result<DesktopInfo, DesktopError>
fn desktop_info( &mut self, icons: &[IconSnapshot], ) -> Result<DesktopInfo, DesktopError>
Source§fn begin_overlay_session(
&mut self,
plans: &[IconRenderPlan],
render_options: OverlayRenderOptions,
) -> Result<(), DesktopError>
fn begin_overlay_session( &mut self, plans: &[IconRenderPlan], render_options: OverlayRenderOptions, ) -> Result<(), DesktopError>
plans. Read moreSource§fn commit_overlay_frame(
&mut self,
positions: &[(IconId, Point)],
) -> Result<(), DesktopError>
fn commit_overlay_frame( &mut self, positions: &[(IconId, Point)], ) -> Result<(), DesktopError>
positions. Read moreSource§fn commit_visual_frame(
&mut self,
frame: &[IconFrame],
) -> Result<(), DesktopError>
fn commit_visual_frame( &mut self, frame: &[IconFrame], ) -> Result<(), DesktopError>
Source§fn discard_overlay_session(&mut self)
fn discard_overlay_session(&mut self)
Source§fn validate_prepared_session(&mut self) -> Result<(), DesktopError>
fn validate_prepared_session(&mut self) -> Result<(), DesktopError>
fn set_real_icons_visible(&mut self, visible: bool) -> Result<(), DesktopError>
fn poll_overlay_session(&mut self) -> Result<(), DesktopError>
Source§fn finalize_overlay_session(
&mut self,
final_positions: &[(IconId, Point)],
) -> Result<FinalCommitOutcome, DesktopError>
fn finalize_overlay_session( &mut self, final_positions: &[(IconId, Point)], ) -> Result<FinalCommitOutcome, DesktopError>
fn prepare_scene_renderer( &mut self, canvas: Canvas, plans: &[IconRenderPlan], options: OverlayRenderOptions, ) -> Result<Box<dyn SceneRenderer>, DesktopError>
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>
fn render_overlay_snapshot( &mut self, width_px: u32, height_px: u32, dpi_scale: f32, positions: &[(IconId, Point)], render_options: OverlayRenderOptions, ) -> Result<SnapshotFrame, DesktopError>
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 moreSource§impl Drop for WindowsBackend
impl Drop for WindowsBackend
Source§fn drop(&mut self)
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.