Merge pull request #215 from hecrj/improvement/update-winit
Update `winit` to `0.22`
This commit is contained in:
commit
3f785472c4
@ -10,7 +10,7 @@ use iced_wgpu::{
|
|||||||
use iced_winit::{winit, Cache, Clipboard, MouseCursor, Size, UserInterface};
|
use iced_winit::{winit, Cache, Clipboard, MouseCursor, Size, UserInterface};
|
||||||
|
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{DeviceEvent, Event, ModifiersState, WindowEvent},
|
event::{Event, ModifiersState, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,14 +66,11 @@ pub fn main() {
|
|||||||
*control_flow = ControlFlow::Wait;
|
*control_flow = ControlFlow::Wait;
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::DeviceEvent {
|
|
||||||
event: DeviceEvent::ModifiersChanged(new_modifiers),
|
|
||||||
..
|
|
||||||
} => {
|
|
||||||
modifiers = new_modifiers;
|
|
||||||
}
|
|
||||||
Event::WindowEvent { event, .. } => {
|
Event::WindowEvent { event, .. } => {
|
||||||
match event {
|
match event {
|
||||||
|
WindowEvent::ModifiersChanged(new_modifiers) => {
|
||||||
|
modifiers = new_modifiers;
|
||||||
|
}
|
||||||
WindowEvent::Resized(new_size) => {
|
WindowEvent::Resized(new_size) => {
|
||||||
logical_size =
|
logical_size =
|
||||||
new_size.to_logical(window.scale_factor());
|
new_size.to_logical(window.scale_factor());
|
||||||
@ -82,6 +79,7 @@ pub fn main() {
|
|||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
*control_flow = ControlFlow::Exit;
|
*control_flow = ControlFlow::Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ categories = ["gui"]
|
|||||||
debug = []
|
debug = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
winit = "0.21"
|
winit = "0.22"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
[dependencies.iced_native]
|
[dependencies.iced_native]
|
||||||
|
@ -347,6 +347,9 @@ pub trait Application: Sized {
|
|||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
*control_flow = ControlFlow::Exit;
|
*control_flow = ControlFlow::Exit;
|
||||||
}
|
}
|
||||||
|
WindowEvent::ModifiersChanged(new_modifiers) => {
|
||||||
|
modifiers = new_modifiers;
|
||||||
|
}
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
WindowEvent::KeyboardInput {
|
WindowEvent::KeyboardInput {
|
||||||
input:
|
input:
|
||||||
@ -382,12 +385,6 @@ pub trait Application: Sized {
|
|||||||
events.push(event);
|
events.push(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event::Event::DeviceEvent {
|
|
||||||
event: event::DeviceEvent::ModifiersChanged(new_modifiers),
|
|
||||||
..
|
|
||||||
} => {
|
|
||||||
modifiers = new_modifiers;
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
*control_flow = ControlFlow::Wait;
|
*control_flow = ControlFlow::Wait;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user