mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/embedded: if a physical key input is a keypad key, keep it
This commit is contained in:
@ -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.
|
||||
|
@ -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,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user