From 2e457c394fa96de0e5b08940c6b8632becd92ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 19 Feb 2020 14:53:08 +0100 Subject: [PATCH] Quit application when `Cmd+Q` is pressed on macOS --- winit/src/application.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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: