Skip to content

Commit ebf8343

Browse files
authored
adds support for numpad Enter key on macos, differentiates between return/enter keys, and removes duplicate lines closes #167 (#168)
1 parent fe7b584 commit ebf8343

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/keycode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ enum _MMKeyCode {
8080
K_DIVIDE = kVK_ANSI_KeypadDivide,
8181
K_MULTIPLY = kVK_ANSI_KeypadMultiply,
8282
K_CLEAR = kVK_ANSI_KeypadClear,
83+
K_ENTER = kVK_ANSI_KeypadEnter,
8384

8485
K_NUMPAD_0 = kVK_ANSI_Keypad0,
8586
K_NUMPAD_1 = kVK_ANSI_Keypad1,
@@ -185,6 +186,7 @@ enum _MMKeyCode {
185186
K_DIVIDE = XK_KP_Divide,
186187
K_MULTIPLY = XK_KP_Multiply,
187188
K_CLEAR = XK_Clear,
189+
K_ENTER = XK_Return,
188190

189191
K_NUMPAD_0 = XK_KP_0,
190192
K_NUMPAD_1 = XK_KP_1,
@@ -287,6 +289,7 @@ enum _MMKeyCode {
287289
K_DIVIDE = VK_DIVIDE,
288290
K_MULTIPLY = VK_MULTIPLY,
289291
K_CLEAR = VK_CLEAR,
292+
K_ENTER = VK_RETURN,
290293

291294
K_NUMPAD_0 = VK_NUMPAD0,
292295
K_NUMPAD_1 = VK_NUMPAD1,

src/main.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static KeyNames key_names[] =
220220
{
221221
{"backspace", K_BACKSPACE},
222222
{"delete", K_DELETE},
223-
{"enter", K_RETURN},
223+
{"return", K_RETURN},
224224
{"tab", K_TAB},
225225
{"escape", K_ESCAPE},
226226
{"up", K_UP},
@@ -306,12 +306,7 @@ static KeyNames key_names[] =
306306
{"multiply", K_MULTIPLY},
307307
{"divide", K_DIVIDE},
308308
{"clear", K_CLEAR},
309-
310-
{"add", K_ADD},
311-
{"subtract", K_SUBTRACT},
312-
{"multiply", K_MULTIPLY},
313-
{"divide", K_DIVIDE},
314-
{"clear", K_CLEAR},
309+
{"enter", K_ENTER},
315310

316311
{"lights_mon_up", K_LIGHTS_MON_UP},
317312
{"lights_mon_down", K_LIGHTS_MON_DOWN},

0 commit comments

Comments
 (0)