From aac7ad3e14aaa9faf7d52fe9b91bc64cb037d576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 9 Mar 2020 22:35:25 +0100 Subject: [PATCH] Update `winit` to `0.22` --- examples/integration/src/main.rs | 12 +++++------- winit/Cargo.toml | 2 +- winit/src/application.rs | 9 +++------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 4be913c1..2cb89ffc 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -10,7 +10,7 @@ use iced_wgpu::{ use iced_winit::{winit, Cache, Clipboard, MouseCursor, Size, UserInterface}; use winit::{ - event::{DeviceEvent, Event, ModifiersState, WindowEvent}, + event::{Event, ModifiersState, WindowEvent}, event_loop::{ControlFlow, EventLoop}, }; @@ -66,14 +66,11 @@ pub fn main() { *control_flow = ControlFlow::Wait; match event { - Event::DeviceEvent { - event: DeviceEvent::ModifiersChanged(new_modifiers), - .. - } => { - modifiers = new_modifiers; - } Event::WindowEvent { event, .. } => { match event { + WindowEvent::ModifiersChanged(new_modifiers) => { + modifiers = new_modifiers; + } WindowEvent::Resized(new_size) => { logical_size = new_size.to_logical(window.scale_factor()); @@ -82,6 +79,7 @@ pub fn main() { WindowEvent::CloseRequested => { *control_flow = ControlFlow::Exit; } + _ => {} } diff --git a/winit/Cargo.toml b/winit/Cargo.toml index 63df1d63..a70ecb9d 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -14,7 +14,7 @@ categories = ["gui"] debug = [] [dependencies] -winit = "0.21" +winit = "0.22" log = "0.4" [dependencies.iced_native] diff --git a/winit/src/application.rs b/winit/src/application.rs index f5aa799c..891b8f12 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -347,6 +347,9 @@ pub trait Application: Sized { WindowEvent::CloseRequested => { *control_flow = ControlFlow::Exit; } + WindowEvent::ModifiersChanged(new_modifiers) => { + modifiers = new_modifiers; + } #[cfg(target_os = "macos")] WindowEvent::KeyboardInput { input: @@ -382,12 +385,6 @@ pub trait Application: Sized { events.push(event); } } - event::Event::DeviceEvent { - event: event::DeviceEvent::ModifiersChanged(new_modifiers), - .. - } => { - modifiers = new_modifiers; - } _ => { *control_flow = ControlFlow::Wait; }