Skip to content

Commit ad943d3

Browse files
committed
adds support for numpad Enter key on macos, differentiates between return/enter keys, and removes duplicate lines closes nut-tree#167
1 parent a85ed35 commit ad943d3

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Diff for: src/keycode.h

+3
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,

Diff for: src/main.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static KeyNames key_names[] =
219219
{
220220
{"backspace", K_BACKSPACE},
221221
{"delete", K_DELETE},
222-
{"enter", K_RETURN},
222+
{"return", K_RETURN},
223223
{"tab", K_TAB},
224224
{"escape", K_ESCAPE},
225225
{"up", K_UP},
@@ -305,12 +305,7 @@ static KeyNames key_names[] =
305305
{"multiply", K_MULTIPLY},
306306
{"divide", K_DIVIDE},
307307
{"clear", K_CLEAR},
308-
309-
{"add", K_ADD},
310-
{"subtract", K_SUBTRACT},
311-
{"multiply", K_MULTIPLY},
312-
{"divide", K_DIVIDE},
313-
{"clear", K_CLEAR},
308+
{"enter", K_ENTER},
314309

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

0 commit comments

Comments
 (0)