core: add context menu key (#5162)

I have this key on a cheap Lenovo keyboard at work and would like to put
it to some use.
This commit is contained in:
Mitchell Hashimoto
2025-05-07 13:25:18 -07:00
committed by GitHub
3 changed files with 7 additions and 1 deletions

View File

@@ -240,6 +240,9 @@ typedef enum {
GHOSTTY_KEY_KP_DELETE,
GHOSTTY_KEY_KP_BEGIN,
// special keys
GHOSTTY_KEY_CONTEXT_MENU,
// modifiers
GHOSTTY_KEY_LEFT_SHIFT,
GHOSTTY_KEY_LEFT_CONTROL,

View File

@@ -401,7 +401,8 @@ pub const Key = enum(c_int) {
kp_delete,
kp_begin,
// TODO: media keys
// special keys
context_menu,
// modifiers
left_shift,
@@ -579,6 +580,7 @@ pub const Key = enum(c_int) {
.backspace => cimgui.c.ImGuiKey_Backspace,
.print_screen => cimgui.c.ImGuiKey_PrintScreen,
.pause => cimgui.c.ImGuiKey_Pause,
.context_menu => cimgui.c.ImGuiKey_Menu,
.f1 => cimgui.c.ImGuiKey_F1,
.f2 => cimgui.c.ImGuiKey_F2,

View File

@@ -153,6 +153,7 @@ const code_to_key = code_to_key: {
.{ "Numpad0", .kp_0 },
.{ "NumpadDecimal", .kp_decimal },
.{ "NumpadEqual", .kp_equal },
.{ "ContextMenu", .context_menu },
.{ "ControlLeft", .left_control },
.{ "ShiftLeft", .left_shift },
.{ "AltLeft", .left_alt },