Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split max/min sizes constraints #2395

Open
amrbashir opened this issue Jul 25, 2022 · 1 comment
Open

Split max/min sizes constraints #2395

amrbashir opened this issue Jul 25, 2022 · 1 comment
Labels
S - enhancement Wouldn't this be the coolest?

Comments

@amrbashir
Copy link
Contributor

amrbashir commented Jul 25, 2022

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>);
}
@maroider maroider added the S - enhancement Wouldn't this be the coolest? label Jul 25, 2022
@madsmtm
Copy link
Member

madsmtm commented Jul 26, 2022

The implementation could build upon #2148

amrbashir added a commit to amrbashir/winit that referenced this issue Feb 26, 2024
kchibisov pushed a commit that referenced this issue Mar 8, 2024
kchibisov pushed a commit that referenced this issue Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S - enhancement Wouldn't this be the coolest?
Development

No branches or pull requests

3 participants