diff options
author | 2020-02-19 14:53:08 +0100 | |
---|---|---|
committer | 2020-02-19 14:53:08 +0100 | |
commit | 2e457c394fa96de0e5b08940c6b8632becd92ccc (patch) | |
tree | 609fb60be08b21f183d7b62a27e46c58a6e9ea8b /winit | |
parent | 80fc8c286e89ec2603f12f1bb060b6070d4d0899 (diff) | |
download | iced-2e457c394fa96de0e5b08940c6b8632becd92ccc.tar.gz iced-2e457c394fa96de0e5b08940c6b8632becd92ccc.tar.bz2 iced-2e457c394fa96de0e5b08940c6b8632becd92ccc.zip |
Quit application when `Cmd+Q` is pressed on macOS
Diffstat (limited to 'winit')
-rw-r--r-- | winit/src/application.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 82478107..f5aa799c 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -347,6 +347,19 @@ pub trait Application: Sized { WindowEvent::CloseRequested => { *control_flow = ControlFlow::Exit; } + #[cfg(target_os = "macos")] + WindowEvent::KeyboardInput { + input: + winit::event::KeyboardInput { + virtual_keycode: + Some(winit::event::VirtualKeyCode::Q), + state: winit::event::ElementState::Pressed, + .. + }, + .. + } if modifiers.logo() => { + *control_flow = ControlFlow::Exit; + } #[cfg(feature = "debug")] WindowEvent::KeyboardInput { input: |