Skip to main content

Module window_state

Module window_state 

Source
Expand description

DPI-independent window geometry persistence and restore.

Base: CodeRight’s window_state (the most developed donor: logical-pixel storage, v0 -> v1 migration, exact-dimension / intersecting / nearest-monitor selection, on-screen title bar clamp, maximised-state memory). Changes: no tokio (debounce on a thread), the state file lives under the shell’s per-app directory, and every label is tracked, not only main.

Structs§

LogicalRect
MonitorSnapshot
RestoreOptions
What WindowStateStore::restore_with does besides positioning. The default does nothing else, which is what restore and the full plugin have always done.
WindowState
WindowStateStore
Per-app store with debounced saves.

Enums§

LegacyImport
Result of WindowStateStore::import_legacy.

Traits§

RestoreTarget
The window calls a restore makes, so the order is testable without a window.

Functions§

apply_restore
Geometry first (size and position, then maximised), then the requested visibility.
next_state
The state to save next. geometry is the live (x, y, width, height) in logical pixels and is only read for a window that is neither maximised nor minimised; otherwise the last normal geometry is kept (or the default rectangle when none was saved).
restoreable_state
Pure geometry projection: where should a saved window land on the current monitors?