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

set_maximized(true) ignores window maximum size when decorations is set to false #464

Open
lucasfernog opened this issue Jul 5, 2022 · 3 comments · May be fixed by #469
Open

set_maximized(true) ignores window maximum size when decorations is set to false #464

lucasfernog opened this issue Jul 5, 2022 · 3 comments · May be fixed by #469

Comments

@lucasfernog
Copy link
Member

lucasfernog commented Jul 5, 2022

The set_maximized API sets the window to have the full monitor size even when a maximum size is set. This issue only happens when the decorations are disabled. Here's an example to reproduce it:

use tao::{
  event::{ElementState, Event, KeyEvent, WindowEvent},
  event_loop::{ControlFlow, EventLoop},
  keyboard::Key,
  window::WindowBuilder,
};

fn main() {
  env_logger::init();
  let event_loop = EventLoop::new();

  let window = WindowBuilder::new()
    .with_title("Hello world!")
    .with_decorations(false)
    .with_max_inner_size(tao::dpi::LogicalSize::new(500.0, 500.0))
    .build(&event_loop)
    .unwrap();

  event_loop.run(move |event, _, control_flow| {
    *control_flow = ControlFlow::Wait;

    match event {
      Event::WindowEvent { event, .. } => match event {
        WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
        WindowEvent::KeyboardInput {
          event:
            KeyEvent {
              logical_key,
              state: ElementState::Pressed,
              ..
            },
          ..
        } => {
          if Key::Character("m") == logical_key {
            let is_maximized = window.is_maximized();
            window.set_maximized(!is_maximized);
          }
        }
        _ => (),
      },
      _ => {}
    }
  });
}

Just run it and press m to call set_maximized(true). You'll see the window resizing to the monitor size, when it should be constrained by the maximum size. It works if you remove the with_decorations(false) line.

This seems like a regression from the last release, @parker-codes said it used to work.

Found it on macOS.

@lucasfernog
Copy link
Member Author

Seems like it's a regression from #453

@amrbashir
Copy link
Member

pinging @keiya01 since he implemented #453

@keiya01 keiya01 linked a pull request Jul 10, 2022 that will close this issue
13 tasks
@keiya01
Copy link
Member

keiya01 commented Jul 10, 2022

I'm sorry, I fixed this issue in #469.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📬Proposal
Development

Successfully merging a pull request may close this issue.

3 participants