Skip to content

Commit

Permalink
Use keyboard-types
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 2, 2024
1 parent c04e6a1 commit 46529b0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1,205 deletions.
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ android-game-activity = ["android-activity/game-activity"]
android-native-activity = ["android-activity/native-activity"]
default = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
mint = ["dpi/mint"]
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde", "dpi/serde", "bitflags/serde"]
serde = [
"dep:serde",
"cursor-icon/serde",
"smol_str/serde",
"dpi/serde",
"bitflags/serde",
"keyboard-types/serde",
]
wayland = [
"wayland-client",
"wayland-backend",
Expand All @@ -79,6 +86,7 @@ cfg_aliases = "0.2.1"
bitflags = "2"
cursor-icon = "1.1.0"
dpi = { version = "0.1.1", path = "dpi" }
keyboard-types = { git = "https://github.com/madsmtm/keyboard-types.git", branch = "winit", default-features = false }
rwh_06 = { package = "raw-window-handle", version = "0.6", features = ["std"] }
serde = { workspace = true, optional = true }
smol_str = "0.2.0"
Expand Down
6 changes: 4 additions & 2 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,15 +732,17 @@ pub struct KeyEvent {
/// The most prevalent use case for this is games. For example the default keys for the player
/// to move around might be the W, A, S, and D keys on a US layout. The position of these keys
/// is more important than their label, so they should map to Z, Q, S, and D on an "AZERTY"
/// layout. (This value is `KeyCode::KeyW` for the Z key on an AZERTY layout.)
/// layout. (This value is [`Code::KeyW`] for the Z key on an AZERTY layout.)
///
/// [`Code::KeyW`]: keyboard_types::Code::KeyW
///
/// ## Caveats
///
/// - Certain niche hardware will shuffle around physical key positions, e.g. a keyboard that
/// implements DVORAK in hardware (or firmware)
/// - Your application will likely have to handle keyboards which are missing keys that your
/// own keyboard has.
/// - Certain `KeyCode`s will move between a couple of different positions depending on what
/// - Certain `Code`s will move between a couple of different positions depending on what
/// layout the keyboard was manufactured to support.
///
/// **Because of these caveats, it is important that you provide users with a way to configure
Expand Down
Loading

0 comments on commit 46529b0

Please sign in to comment.