mirror of https://github.com/mpv-player/mpv
various: handle numpad add/subtract/multiply/divide keycodes
This commit is contained in:
parent
ab0aaaad39
commit
f3a00ea131
|
@ -0,0 +1 @@
|
|||
remap numpad `+ - * /` keys to `KP_ADD/KP_SUBTRACT/KP_MULTIPLY/KP_KPDIVIDE`; keybinds which require these numpad keys to function need to use the new names instead
|
|
@ -49,10 +49,10 @@ class InputHelper: NSObject {
|
|||
.init(kVK_F19, MP_KEY_F + 19), .init(kVK_F20, MP_KEY_F + 20),
|
||||
|
||||
// numpad
|
||||
.init(kVK_ANSI_KeypadPlus, Int32(Character("+").asciiValue ?? 0)),
|
||||
.init(kVK_ANSI_KeypadMinus, Int32(Character("-").asciiValue ?? 0)),
|
||||
.init(kVK_ANSI_KeypadMultiply, Int32(Character("*").asciiValue ?? 0)),
|
||||
.init(kVK_ANSI_KeypadDivide, Int32(Character("/").asciiValue ?? 0)),
|
||||
.init(kVK_ANSI_KeypadPlus, MP_KEY_KPADD),
|
||||
.init(kVK_ANSI_KeypadMinus, MP_KEY_KPSUBTRACT),
|
||||
.init(kVK_ANSI_KeypadMultiply, MP_KEY_KPMULTIPLY),
|
||||
.init(kVK_ANSI_KeypadDivide, MP_KEY_KPDIVIDE),
|
||||
.init(kVK_ANSI_KeypadEnter, MP_KEY_KPENTER), .init(kVK_ANSI_KeypadDecimal, MP_KEY_KPDEC),
|
||||
.init(kVK_ANSI_Keypad0, MP_KEY_KP0), .init(kVK_ANSI_Keypad1, MP_KEY_KP1),
|
||||
.init(kVK_ANSI_Keypad2, MP_KEY_KP2), .init(kVK_ANSI_Keypad3, MP_KEY_KP3),
|
||||
|
|
|
@ -57,6 +57,10 @@ static const struct keymap vk_map[] = {
|
|||
{VK_F19, MP_KEY_F+19}, {VK_F20, MP_KEY_F+20}, {VK_F21, MP_KEY_F+21},
|
||||
{VK_F22, MP_KEY_F+22}, {VK_F23, MP_KEY_F+23}, {VK_F24, MP_KEY_F+24},
|
||||
|
||||
// numpad independent of numlock
|
||||
{VK_SUBTRACT, MP_KEY_KPSUBTRACT}, {VK_ADD, MP_KEY_KPADD},
|
||||
{VK_MULTIPLY, MP_KEY_KPMULTIPLY}, {VK_DIVIDE, MP_KEY_KPDIVIDE},
|
||||
|
||||
// numpad with numlock
|
||||
{VK_NUMPAD0, MP_KEY_KP0}, {VK_NUMPAD1, MP_KEY_KP1},
|
||||
{VK_NUMPAD2, MP_KEY_KP2}, {VK_NUMPAD3, MP_KEY_KP3},
|
||||
|
|
|
@ -100,6 +100,10 @@ const struct keymap_entry keys[] = {
|
|||
{SDLK_LEFT, MP_KEY_LEFT},
|
||||
{SDLK_DOWN, MP_KEY_DOWN},
|
||||
{SDLK_UP, MP_KEY_UP},
|
||||
{SDLK_KP_PLUS, MP_KEY_KPADD},
|
||||
{SDLK_KP_MINUS, MP_KEY_KPSUBTRACT},
|
||||
{SDLK_KP_MULTIPLY, MP_KEY_KPMULTIPLY},
|
||||
{SDLK_KP_DIVIDE, MP_KEY_KPDIVIDE},
|
||||
{SDLK_KP_ENTER, MP_KEY_KPENTER},
|
||||
{SDLK_KP_1, MP_KEY_KP1},
|
||||
{SDLK_KP_2, MP_KEY_KP2},
|
||||
|
|
|
@ -97,8 +97,8 @@ static const struct mp_keymap keymap[] = {
|
|||
{XKB_KEY_F23, MP_KEY_F +23}, {XKB_KEY_F24, MP_KEY_F +24},
|
||||
|
||||
/* Numpad independent of numlock */
|
||||
{XKB_KEY_KP_Subtract, '-'}, {XKB_KEY_KP_Add, '+'},
|
||||
{XKB_KEY_KP_Multiply, '*'}, {XKB_KEY_KP_Divide, '/'},
|
||||
{XKB_KEY_KP_Subtract, MP_KEY_KPSUBTRACT}, {XKB_KEY_KP_Add, MP_KEY_KPADD},
|
||||
{XKB_KEY_KP_Multiply, MP_KEY_KPMULTIPLY}, {XKB_KEY_KP_Divide, MP_KEY_KPDIVIDE},
|
||||
{XKB_KEY_KP_Enter, MP_KEY_KPENTER},
|
||||
|
||||
/* Numpad with numlock */
|
||||
|
|
|
@ -786,8 +786,9 @@ static const struct mp_keymap keymap[] = {
|
|||
{XK_F22, MP_KEY_F+22}, {XK_F23, MP_KEY_F+23}, {XK_F24, MP_KEY_F+24},
|
||||
|
||||
// numpad independent of numlock
|
||||
{XK_KP_Subtract, '-'}, {XK_KP_Add, '+'}, {XK_KP_Multiply, '*'},
|
||||
{XK_KP_Divide, '/'}, {XK_KP_Enter, MP_KEY_KPENTER},
|
||||
{XK_KP_Subtract, MP_KEY_KPSUBTRACT}, {XK_KP_Add, MP_KEY_KPADD},
|
||||
{XK_KP_Multiply, MP_KEY_KPMULTIPLY}, {XK_KP_Divide, MP_KEY_KPDIVIDE},
|
||||
{XK_KP_Enter, MP_KEY_KPENTER},
|
||||
|
||||
// numpad with numlock
|
||||
{XK_KP_0, MP_KEY_KP0}, {XK_KP_1, MP_KEY_KP1}, {XK_KP_2, MP_KEY_KP2},
|
||||
|
|
Loading…
Reference in New Issue