diff --git a/src/Surface.zig b/src/Surface.zig index e173d2d8b..a71c180ff 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1870,7 +1870,7 @@ pub fn keyCallback( // Process the cursor state logic. This will update the cursor shape if // needed, depending on the key state. if ((SurfaceMouse{ - .physical_key = event.physical_key, + .physical_key = event.key, .mouse_event = self.io.terminal.flags.mouse_event, .mouse_shape = self.io.terminal.mouse_shape, .mods = self.mouse.mods, diff --git a/src/apprt/embedded.zig b/src/apprt/embedded.zig index cf3f73a55..7bc84bcad 100644 --- a/src/apprt/embedded.zig +++ b/src/apprt/embedded.zig @@ -98,7 +98,6 @@ pub const App = struct { return .{ .action = self.action, .key = physical_key, - .physical_key = physical_key, .mods = self.mods, .consumed_mods = self.consumed_mods, .composing = self.composing, diff --git a/src/apprt/glfw.zig b/src/apprt/glfw.zig index 763933b91..e416d5645 100644 --- a/src/apprt/glfw.zig +++ b/src/apprt/glfw.zig @@ -1108,7 +1108,6 @@ pub const Surface = struct { const key_event: input.KeyEvent = .{ .action = action, .key = key, - .physical_key = key, .mods = mods, .consumed_mods = .{}, .composing = false, diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index a04372494..0a9f644b7 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -1891,7 +1891,6 @@ pub fn keyEvent( const effect = self.core_surface.keyCallback(.{ .action = action, .key = physical_key, - .physical_key = physical_key, .mods = mods, .consumed_mods = consumed_mods, .composing = self.im_composing, @@ -2043,7 +2042,6 @@ fn gtkInputCommit( _ = self.core_surface.keyCallback(.{ .action = .press, .key = .unidentified, - .physical_key = .unidentified, .mods = .{}, .consumed_mods = .{}, .composing = false, diff --git a/src/input/Binding.zig b/src/input/Binding.zig index e6347ab9d..2c53fb49f 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -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; diff --git a/src/input/KeyEncoder.zig b/src/input/KeyEncoder.zig index 3d43a4e86..7f9972779 100644 --- a/src/input/KeyEncoder.zig +++ b/src/input/KeyEncoder.zig @@ -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, diff --git a/src/input/key.zig b/src/input/key.zig index d9ef284d1..831c9f07f 100644 --- a/src/input/key.zig +++ b/src/input/key.zig @@ -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()); diff --git a/src/inspector/key.zig b/src/inspector/key.zig index 10626d6bd..dbccb47a8 100644 --- a/src/inspector/key.zig +++ b/src/inspector/key.zig @@ -117,13 +117,6 @@ pub const Event = struct { _ = cimgui.c.igTableSetColumnIndex(1); cimgui.c.igText("%s", @tagName(self.event.key).ptr); } - if (self.event.physical_key != self.event.key) { - cimgui.c.igTableNextRow(cimgui.c.ImGuiTableRowFlags_None, 0); - _ = cimgui.c.igTableSetColumnIndex(0); - cimgui.c.igText("Physical Key"); - _ = cimgui.c.igTableSetColumnIndex(1); - cimgui.c.igText("%s", @tagName(self.event.physical_key).ptr); - } if (!self.event.mods.empty()) { cimgui.c.igTableNextRow(cimgui.c.ImGuiTableRowFlags_None, 0); _ = cimgui.c.igTableSetColumnIndex(0);