input: remove physical_key from the key event (all keys are physical)

This commit is contained in:
Mitchell Hashimoto
2025-05-08 20:53:09 -07:00
parent 11a623aa17
commit 5962696c3b
8 changed files with 6 additions and 21 deletions

View File

@@ -1731,7 +1731,7 @@ pub const Set = struct {
pub fn getEvent(self: *const Set, event: KeyEvent) ?Entry {
var trigger: Trigger = .{
.mods = event.mods.binding(),
.key = .{ .physical = event.physical_key },
.key = .{ .physical = event.key },
};
if (self.get(trigger)) |v| return v;

View File

@@ -2190,7 +2190,6 @@ test "legacy: hu layout ctrl+ő sends proper codepoint" {
var enc: KeyEncoder = .{
.event = .{
.key = .bracket_left,
.physical_key = .bracket_left,
.mods = .{ .ctrl = true },
.utf8 = "ő",
.unshifted_codepoint = 337,

View File

@@ -16,12 +16,10 @@ pub const KeyEvent = struct {
/// The action: press, release, etc.
action: Action = .press,
/// "key" is the logical key that was pressed. For example, if
/// a Dvorak keyboard layout is being used on a US keyboard,
/// the "i" physical key will be reported as "c". The physical
/// key is the key that was physically pressed on the keyboard.
key: Key,
physical_key: Key = .unidentified,
/// The keycode of the physical key that was pressed. This is agnostic
/// to the layout. Layout-dependent matching can only be done via the
/// UTF-8 or unshifted codepoint.
key: Key = .unidentified,
/// Mods are the modifiers that are pressed.
mods: Mods = .{},
@@ -63,7 +61,6 @@ pub const KeyEvent = struct {
// These are all the fields that are explicitly part of Trigger.
std.hash.autoHash(&hasher, self.key);
std.hash.autoHash(&hasher, self.physical_key);
std.hash.autoHash(&hasher, self.unshifted_codepoint);
std.hash.autoHash(&hasher, self.mods.binding());