From f69ff611cb410c950bc14058cedc63127b621fbe Mon Sep 17 00:00:00 2001 From: Chris Statkiewicz Date: Fri, 7 Mar 2025 22:12:14 +0200 Subject: [PATCH 1/5] expose handle_window_event for WinitPlatform trait Suits the winit API changes introduced in 0.30.0: https://github.com/rust-windowing/winit/releases/tag/v0.30.0 --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 6561047..fa328a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,7 +157,7 @@ impl WinitPlatform { _ => (), } } - fn handle_window_event(&mut self, io: &mut Io, window: &Window, event: &WindowEvent) { + pub fn handle_window_event(&mut self, io: &mut Io, window: &Window, event: &WindowEvent) { match *event { WindowEvent::Resized(physical_size) => { let logical_size = physical_size.to_logical(window.scale_factor()); From 7c3d34d9ef8077d39b56220522fd0a39e1fedf98 Mon Sep 17 00:00:00 2001 From: Chris Statkiewicz Date: Fri, 7 Mar 2025 22:23:38 +0200 Subject: [PATCH 2/5] Add doc comment for handle_window_event --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index fa328a2..b088917 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,6 +157,14 @@ impl WinitPlatform { _ => (), } } + + /// Handles a winit window event. + /// + /// This function performs the following actions (depends on the event): + /// + /// * window size / dpi factor changes are applied + /// * keyboard state is updated + /// * mouse state is updated pub fn handle_window_event(&mut self, io: &mut Io, window: &Window, event: &WindowEvent) { match *event { WindowEvent::Resized(physical_size) => { From 412778106f1659e809130c75fd4e3be76d50a8da Mon Sep 17 00:00:00 2001 From: Chris Statkiewicz Date: Fri, 7 Mar 2025 22:24:06 +0200 Subject: [PATCH 3/5] bump winit dependency --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f09aa36..d6e5290 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ categories = ["gui"] [dependencies] imgui = { git = "https://github.com/imgui-rs/imgui-rs", version = "0.12" } -winit = { version = "0.30", default-features = false } \ No newline at end of file +winit = { version = "0.30.9", default-features = false } \ No newline at end of file From d39cb908693d1ea41570b520dd44b206ae4f1fbc Mon Sep 17 00:00:00 2001 From: Chris Statkiewicz Date: Fri, 7 Mar 2025 22:47:31 +0200 Subject: [PATCH 4/5] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d6e5290..3aa20f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,5 @@ license = "MIT OR Apache-2.0" categories = ["gui"] [dependencies] -imgui = { git = "https://github.com/imgui-rs/imgui-rs", version = "0.12" } +imgui = "0.12" winit = { version = "0.30.9", default-features = false } \ No newline at end of file From 4e6923e320561d0d50ec20a94d2eb563088a9139 Mon Sep 17 00:00:00 2001 From: Chris Statkiewicz Date: Fri, 7 Mar 2025 23:03:22 +0200 Subject: [PATCH 5/5] undo winit bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3aa20f7..08ee68c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ categories = ["gui"] [dependencies] imgui = "0.12" -winit = { version = "0.30.9", default-features = false } \ No newline at end of file +winit = { version = "0.30", default-features = false } \ No newline at end of file