pub struct Placement {
pub monitor: MonitorSelector,
pub area: Area,
pub fit: Fit,
pub opacity: f32,
pub always_on_top: bool,
pub fall_back_to_primary: bool,
}Expand description
What to show, where, and how.
Fields§
§monitor: MonitorSelectorWhich monitor.
area: AreaWhat part of it.
fit: FitHow the picture sits inside that area. Ignored for
Area::Corners, which pins the picture’s own corners and so has no
spare room to fit anything into.
opacity: f320.0 to 1.0. The “translucent” the name promises.
always_on_top: boolWhether to keep this above other windows. Only meaningful when vtome owns the window.
fall_back_to_primary: boolWhether to fall back to the primary monitor when the selector finds nothing, rather than failing.
On by default: a show that loses a projector should carry on somewhere visible, and say so, rather than stop.
Implementations§
Source§impl Placement
impl Placement
Sourcepub fn new(monitor: MonitorSelector) -> Self
pub fn new(monitor: MonitorSelector) -> Self
A full-screen placement on the monitor a selector names.
Sourcepub fn corners_normalized(self, quad: Quad) -> Self
pub fn corners_normalized(self, quad: Quad) -> Self
Four corners as fractions of the monitor, 0.0 to 1.0.
Prefer this when the monitor’s size is not known yet — see
Area::NormalizedCorners.
Sourcepub fn keystone(self, inset: f64) -> Self
pub fn keystone(self, inset: f64) -> Self
A symmetric keystone over the whole monitor, narrowing the top edge by
inset of the width at each end.
The projector-aimed-upwards case, in one call and without needing to
know the monitor’s size. 0.1 is a mild correction; 0.4 is nearly a
triangle.
Sourcepub fn always_on_top(self, on_top: bool) -> Self
pub fn always_on_top(self, on_top: bool) -> Self
Whether to stay above other windows.
Sourcepub fn require_monitor(self, required: bool) -> Self
pub fn require_monitor(self, required: bool) -> Self
Whether a missing monitor is an error rather than a fallback.
Sourcepub fn resolve(
&self,
source_width: u32,
source_height: u32,
monitors: &[Monitor],
) -> Result<ResolvedPlacement>
pub fn resolve( &self, source_width: u32, source_height: u32, monitors: &[Monitor], ) -> Result<ResolvedPlacement>
Works out where a source_width × source_height picture actually goes.
Everything in the result is in desktop coordinates, so a caller can hand it straight to a window system without knowing which monitor it came from.
§Errors
Error::NoSuchMonitor if nothing matches and fallback is off,
Error::Placement for an opacity outside 0..=1, an empty rectangle,
or a quad that is not convex.