rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.78k stars 892 forks source link

Split max/min sizes constraints #2395

Open amrbashir opened 2 years ago

amrbashir commented 2 years ago

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); // conversion methods similar to PhysicalSize

[derive(Debug, Copy, Clone, PartialEq)]

enum Unit { Physical(PhysicalUnit), Logical(LogicalUnit), } // conversion methods similar to Size

impl WindowBuilder { fn with_max_inner_size<S: Into>(width: Option, height: Option); }

madsmtm commented 2 years ago

The implementation could build upon https://github.com/rust-windowing/winit/pull/2148