From 9d4720ca0ec5a256b26536c39770b34371524044 Mon Sep 17 00:00:00 2001 From: icedrocket <114203630+icedrocket@users.noreply.github.com> Date: Sun, 24 Sep 2023 19:58:50 +0900 Subject: [PATCH] eframe: fix unexpected change with winit 0.28 --- crates/eframe/src/native/epi_integration.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index 3912410d8bf..bc492eb9be1 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -112,6 +112,16 @@ pub fn window_builder( // We must also keep the window hidden until AccessKit is initialized. .with_visible(false); + // As of winit 0.28, with the addition of the WindowsButtons API, resizable no + // longer controls whether the maximize button is disabled. So here we emulate + // the behavior of older versions of winit until we change our API. + // + // https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md#0280 + if !resizable { + window_builder = + window_builder.with_enabled_buttons(!winit::window::WindowButtons::MAXIMIZE); + } + #[cfg(target_os = "macos")] if *fullsize_content { window_builder = window_builder