From b76ae1f7bc470e7abcd7eea37f55b0bd271cfe64 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Sat, 29 May 2021 02:18:48 -0700 Subject: [PATCH] Update winit to 0.25 (#168) - Update winit - Update egui_winit_platform - Update imgui_winit_support - Fix hyperlink and resize in `egui-winit` example --- Cargo.toml | 2 +- examples/conway/Cargo.toml | 4 ++-- examples/custom-shader/Cargo.toml | 4 ++-- examples/egui-winit/Cargo.toml | 10 +++++++--- examples/egui-winit/src/gui.rs | 22 +++++++++++++++++++--- examples/imgui-winit/Cargo.toml | 6 +++--- examples/invaders/Cargo.toml | 4 ++-- examples/minimal-winit/Cargo.toml | 4 ++-- examples/raqote-winit/Cargo.toml | 4 ++-- 9 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8c51627..7cbd350 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ wgpu = "0.8.1" [dev-dependencies] pixels-mocks = { path = "internals/pixels-mocks" } -winit = "0.24" +winit = "0.25" [workspace] resolver = "2" diff --git a/examples/conway/Cargo.toml b/examples/conway/Cargo.toml index 5597b84..833cae7 100644 --- a/examples/conway/Cargo.toml +++ b/examples/conway/Cargo.toml @@ -17,5 +17,5 @@ line_drawing = "0.8" log = "0.4" pixels = { path = "../.." } randomize = "3.0" -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" diff --git a/examples/custom-shader/Cargo.toml b/examples/custom-shader/Cargo.toml index e7bd697..dfe5b76 100644 --- a/examples/custom-shader/Cargo.toml +++ b/examples/custom-shader/Cargo.toml @@ -13,5 +13,5 @@ default = ["optimize"] env_logger = "0.8" log = "0.4" pixels = { path = "../.." } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" diff --git a/examples/egui-winit/Cargo.toml b/examples/egui-winit/Cargo.toml index 4e61c3a..7734af9 100644 --- a/examples/egui-winit/Cargo.toml +++ b/examples/egui-winit/Cargo.toml @@ -12,9 +12,13 @@ default = ["optimize"] [dependencies] egui = "0.12" egui_wgpu_backend = "0.8" -egui_winit_platform = "0.7" env_logger = "0.8" log = "0.4" pixels = { path = "../.." } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" + +[dependencies.egui_winit_platform] +git = "https://github.com/hasenbanck/egui_winit_platform.git" +rev = "9fd92782d8de22d7882168d7b5ae7a2eb02448d9" +features = ["webbrowser"] diff --git a/examples/egui-winit/src/gui.rs b/examples/egui-winit/src/gui.rs index 55f0a8f..b15fcde 100644 --- a/examples/egui-winit/src/gui.rs +++ b/examples/egui-winit/src/gui.rs @@ -46,13 +46,29 @@ impl Gui { /// Handle input events from the window manager. pub(crate) fn handle_event(&mut self, event: &winit::event::Event<'_, ()>) { - self.platform.handle_event(event); + use winit::dpi::PhysicalSize; + use winit::event::Event::WindowEvent; + use winit::event::WindowEvent::Resized; + + match &event { + WindowEvent { + event: + Resized(PhysicalSize { + width: 0, + height: 0, + }), + .. + } => (), + _ => self.platform.handle_event(event), + } } /// Resize egui. pub(crate) fn resize(&mut self, width: u32, height: u32) { - self.screen_descriptor.physical_width = width; - self.screen_descriptor.physical_height = height; + if width > 0 && height > 0 { + self.screen_descriptor.physical_width = width; + self.screen_descriptor.physical_height = height; + } } /// Update scaling factor. diff --git a/examples/imgui-winit/Cargo.toml b/examples/imgui-winit/Cargo.toml index d0a76ef..093ba69 100644 --- a/examples/imgui-winit/Cargo.toml +++ b/examples/imgui-winit/Cargo.toml @@ -13,8 +13,8 @@ default = ["optimize"] env_logger = "0.8" imgui = "0.7" imgui-wgpu = "0.15.1" -imgui-winit-support = "0.7" +imgui-winit-support = { version = "0.7.1", default-features = false, features = ["winit-25"] } log = "0.4" pixels = { path = "../.." } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" diff --git a/examples/invaders/Cargo.toml b/examples/invaders/Cargo.toml index e3f7a04..553b292 100644 --- a/examples/invaders/Cargo.toml +++ b/examples/invaders/Cargo.toml @@ -18,5 +18,5 @@ log = "0.4" pixels = { path = "../.." } randomize = "3.0" simple-invaders = { path = "simple-invaders" } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" diff --git a/examples/minimal-winit/Cargo.toml b/examples/minimal-winit/Cargo.toml index 957fa1b..7ee73e5 100644 --- a/examples/minimal-winit/Cargo.toml +++ b/examples/minimal-winit/Cargo.toml @@ -13,5 +13,5 @@ default = ["optimize"] env_logger = "0.8" log = "0.4" pixels = { path = "../.." } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10" diff --git a/examples/raqote-winit/Cargo.toml b/examples/raqote-winit/Cargo.toml index 359d1d1..14b77a3 100644 --- a/examples/raqote-winit/Cargo.toml +++ b/examples/raqote-winit/Cargo.toml @@ -15,5 +15,5 @@ euclid = "0.22" log = "0.4" pixels = { path = "../.." } raqote = { git = "https://github.com/jrmuizel/raqote.git", rev = "74f0afa2be54561c1a9928e885ab95e8a4c5322d", default-features = false } -winit = "0.24" -winit_input_helper = "0.9" +winit = "0.25" +winit_input_helper = "0.10"