diff --git a/src/apprt/embedded.zig b/src/apprt/embedded.zig index ac5a45259..fed00b088 100644 --- a/src/apprt/embedded.zig +++ b/src/apprt/embedded.zig @@ -595,6 +595,9 @@ pub const Surface = struct { // // We also only do key translation if this is not a dead key. const key = if (!result.composing) key: { + // If our physical key is a keypad key, we use that. + if (physical_key.keypad()) break :key physical_key; + // A completed key. If the length of the key is one then we can // attempt to translate it to a key enum and call the key // callback. First try plain ASCII. diff --git a/src/input/key.zig b/src/input/key.zig index 46263bf30..830501772 100644 --- a/src/input/key.zig +++ b/src/input/key.zig @@ -422,4 +422,30 @@ pub const Key = enum(c_int) { else => false, }; } + + /// Returns true if this is a keypad key. + pub fn keypad(self: Key) bool { + return switch (self) { + .kp_0, + .kp_1, + .kp_2, + .kp_3, + .kp_4, + .kp_5, + .kp_6, + .kp_7, + .kp_8, + .kp_9, + .kp_decimal, + .kp_divide, + .kp_multiply, + .kp_subtract, + .kp_add, + .kp_enter, + .kp_equal, + => true, + + else => false, + }; + } };