input: remove `physical_key` from the key event (all keys are physical)
parent
11a623aa17
commit
5962696c3b
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue