From 8b34f99b02858a8a0986fd106236f322b35f34a0 Mon Sep 17 00:00:00 2001 From: ibaryshnikov Date: Thu, 26 Sep 2024 17:13:32 +0300 Subject: [PATCH 1/2] added physical_key to KeyReleased event --- core/src/keyboard/event.rs | 3 +++ winit/src/conversion.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/core/src/keyboard/event.rs b/core/src/keyboard/event.rs index 26c457170a..0c97d26fd5 100644 --- a/core/src/keyboard/event.rs +++ b/core/src/keyboard/event.rs @@ -36,6 +36,9 @@ pub enum Event { /// The key released. key: Key, + /// The physical key released. + physical_key: key::Physical, + /// The location of the key. location: Location, diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index 43e1848b4a..04cbb98240 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -262,6 +262,7 @@ pub fn window_event( winit::event::ElementState::Released => { keyboard::Event::KeyReleased { key, + physical_key, modifiers, location, } From 32cdc99e928876ef75c6543362665d82cee63f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 2 Oct 2024 16:53:10 +0200 Subject: [PATCH 2/2] Add `modified_key` to `keyboard::Event::KeyReleased` --- core/src/keyboard/event.rs | 3 +++ winit/src/conversion.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/core/src/keyboard/event.rs b/core/src/keyboard/event.rs index 0c97d26fd5..6e483f5be9 100644 --- a/core/src/keyboard/event.rs +++ b/core/src/keyboard/event.rs @@ -36,6 +36,9 @@ pub enum Event { /// The key released. key: Key, + /// The key released with all keyboard modifiers applied, except Ctrl. + modified_key: Key, + /// The physical key released. physical_key: key::Physical, diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index 04cbb98240..5d0f834817 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -262,6 +262,7 @@ pub fn window_event( winit::event::ElementState::Released => { keyboard::Event::KeyReleased { key, + modified_key, physical_key, modifiers, location,