From ab0aaaad3935ced91529695131a6f291ab218283 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:35:26 -0400 Subject: [PATCH] input/keycodes: add KP_ADD/SUBTRACT/MULTIPLY/DIVIDE keycodes In general, mpv treats numpad keys as separate inputs. The +-*/ keys however are exceptions so it's not possible to distinguish them from non-numpad keys. This adds keycodes corresponding to these keys so that they can be handled differently. --- input/keycodes.c | 4 ++++ input/keycodes.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/input/keycodes.c b/input/keycodes.c index 73ee6ed222..418389bd4d 100644 --- a/input/keycodes.c +++ b/input/keycodes.c @@ -99,6 +99,10 @@ static const struct key_name key_names[] = { { MP_KEY_KPDOWN, "KP_DOWN" }, { MP_KEY_KPUP, "KP_UP" }, { MP_KEY_KPENTER, "KP_ENTER" }, + { MP_KEY_KPADD, "KP_ADD" }, + { MP_KEY_KPSUBTRACT, "KP_SUBTRACT" }, + { MP_KEY_KPMULTIPLY, "KP_MULTIPLY" }, + { MP_KEY_KPDIVIDE, "KP_DIVIDE" }, { MP_MBTN_LEFT, "MBTN_LEFT" }, { MP_MBTN_MID, "MBTN_MID" }, { MP_MBTN_RIGHT, "MBTN_RIGHT" }, diff --git a/input/keycodes.h b/input/keycodes.h index a4b35cd871..6e796015b5 100644 --- a/input/keycodes.h +++ b/input/keycodes.h @@ -116,6 +116,10 @@ #define MP_KEY_KPDOWN (MP_KEY_KEYPAD+20) #define MP_KEY_KPUP (MP_KEY_KEYPAD+21) #define MP_KEY_KPBEGIN (MP_KEY_KEYPAD+22) +#define MP_KEY_KPADD (MP_KEY_KEYPAD+23) +#define MP_KEY_KPSUBTRACT (MP_KEY_KEYPAD+24) +#define MP_KEY_KPMULTIPLY (MP_KEY_KEYPAD+25) +#define MP_KEY_KPDIVIDE (MP_KEY_KEYPAD+26) // Mouse events from VOs #define MP_MBTN_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP)