Skip to content

Commit

Permalink
adds support for numpad Enter key on macos, differentiates between re…
Browse files Browse the repository at this point in the history
…turn/enter keys, and removes duplicate lines closes #167 (#168)
  • Loading branch information
smithkyle authored Jan 29, 2024
1 parent fe7b584 commit ebf8343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ enum _MMKeyCode {
K_DIVIDE = kVK_ANSI_KeypadDivide,
K_MULTIPLY = kVK_ANSI_KeypadMultiply,
K_CLEAR = kVK_ANSI_KeypadClear,
K_ENTER = kVK_ANSI_KeypadEnter,

K_NUMPAD_0 = kVK_ANSI_Keypad0,
K_NUMPAD_1 = kVK_ANSI_Keypad1,
Expand Down Expand Up @@ -185,6 +186,7 @@ enum _MMKeyCode {
K_DIVIDE = XK_KP_Divide,
K_MULTIPLY = XK_KP_Multiply,
K_CLEAR = XK_Clear,
K_ENTER = XK_Return,

K_NUMPAD_0 = XK_KP_0,
K_NUMPAD_1 = XK_KP_1,
Expand Down Expand Up @@ -287,6 +289,7 @@ enum _MMKeyCode {
K_DIVIDE = VK_DIVIDE,
K_MULTIPLY = VK_MULTIPLY,
K_CLEAR = VK_CLEAR,
K_ENTER = VK_RETURN,

K_NUMPAD_0 = VK_NUMPAD0,
K_NUMPAD_1 = VK_NUMPAD1,
Expand Down
9 changes: 2 additions & 7 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static KeyNames key_names[] =
{
{"backspace", K_BACKSPACE},
{"delete", K_DELETE},
{"enter", K_RETURN},
{"return", K_RETURN},
{"tab", K_TAB},
{"escape", K_ESCAPE},
{"up", K_UP},
Expand Down Expand Up @@ -306,12 +306,7 @@ static KeyNames key_names[] =
{"multiply", K_MULTIPLY},
{"divide", K_DIVIDE},
{"clear", K_CLEAR},

{"add", K_ADD},
{"subtract", K_SUBTRACT},
{"multiply", K_MULTIPLY},
{"divide", K_DIVIDE},
{"clear", K_CLEAR},
{"enter", K_ENTER},

{"lights_mon_up", K_LIGHTS_MON_UP},
{"lights_mon_down", K_LIGHTS_MON_DOWN},
Expand Down

0 comments on commit ebf8343

Please sign in to comment.