winit
winit copied to clipboard
Split max/min sizes constraints
I think it is a valid use-case to only constrain the window width or height.
I think an implementation of this would be similar to LogicalSize
and PhysicalSize
I couldn't think of a better names so these are subject to change ofc
#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash)]
struct LogicalUnit<P>(P);
// conversion methods similar to `LogicalSize`
#[derive(Debug, Copy, Clone, Eq, PartialEq, Default, Hash)]
struct PhysicalUnit<P>(P);
// conversion methods similar to `PhysicalSize`
#[derive(Debug, Copy, Clone, PartialEq)]
enum Unit {
Physical(PhysicalUnit<u32>),
Logical(LogicalUnit<f64>),
}
// conversion methods similar to `Size`
impl WindowBuilder {
fn with_max_inner_size<S: Into<Unit>>(width: Option<U>, height: Option<U>);
}
The implementation could build upon https://github.com/rust-windowing/winit/pull/2148