From ebf8343bbdb2f8346b9c03a0b69842f9f06855cf Mon Sep 17 00:00:00 2001 From: Kyle Smith Date: Mon, 29 Jan 2024 13:30:55 -0800 Subject: [PATCH] adds support for numpad Enter key on macos, differentiates between return/enter keys, and removes duplicate lines closes #167 (#168) --- src/keycode.h | 3 +++ src/main.cc | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/keycode.h b/src/keycode.h index 8275598..f5bb2cb 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -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, @@ -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, @@ -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, diff --git a/src/main.cc b/src/main.cc index 44ba957..72f84a9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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}, @@ -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},