diff options
Diffstat (limited to 'input')
-rw-r--r-- | input/input.c | 4 | ||||
-rw-r--r-- | input/keycodes.c | 88 | ||||
-rw-r--r-- | input/keycodes.h | 77 |
3 files changed, 80 insertions, 89 deletions
diff --git a/input/input.c b/input/input.c index ed7c1ec160..88527b5974 100644 --- a/input/input.c +++ b/input/input.c @@ -732,8 +732,8 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale, if (ictx->last_doubleclick_key_down == code && now - ictx->last_doubleclick_time < opts->doubleclick_time / 1000.0) { - if (code >= MP_MOUSE_BTN0 && code <= MP_MOUSE_BTN2) { - interpret_key(ictx, code - MP_MOUSE_BTN0 + MP_MOUSE_BTN0_DBL, + if (code >= MP_MBTN_LEFT && code <= MP_MBTN_RIGHT) { + interpret_key(ictx, code - MP_MOUSE_BASE + MP_MOUSE_DBL_BASE, 1, 1); } } diff --git a/input/keycodes.c b/input/keycodes.c index cb446f5069..0832616129 100644 --- a/input/keycodes.c +++ b/input/keycodes.c @@ -78,46 +78,29 @@ static const struct key_name key_names[] = { { MP_KEY_KPDEC, "KP_DEC" }, { MP_KEY_KPINS, "KP_INS" }, { MP_KEY_KPENTER, "KP_ENTER" }, - { MP_MOUSE_BTN0, "MOUSE_BTN0" }, - { MP_MOUSE_BTN1, "MOUSE_BTN1" }, - { MP_MOUSE_BTN2, "MOUSE_BTN2" }, - { MP_MOUSE_BTN3, "MOUSE_BTN3" }, - { MP_MOUSE_BTN4, "MOUSE_BTN4" }, - { MP_MOUSE_BTN5, "MOUSE_BTN5" }, - { MP_MOUSE_BTN6, "MOUSE_BTN6" }, - { MP_MOUSE_BTN7, "MOUSE_BTN7" }, - { MP_MOUSE_BTN8, "MOUSE_BTN8" }, - { MP_MOUSE_BTN9, "MOUSE_BTN9" }, - { MP_MOUSE_BTN10, "MOUSE_BTN10" }, - { MP_MOUSE_BTN11, "MOUSE_BTN11" }, - { MP_MOUSE_BTN12, "MOUSE_BTN12" }, - { MP_MOUSE_BTN13, "MOUSE_BTN13" }, - { MP_MOUSE_BTN14, "MOUSE_BTN14" }, - { MP_MOUSE_BTN15, "MOUSE_BTN15" }, - { MP_MOUSE_BTN16, "MOUSE_BTN16" }, - { MP_MOUSE_BTN17, "MOUSE_BTN17" }, - { MP_MOUSE_BTN18, "MOUSE_BTN18" }, - { MP_MOUSE_BTN19, "MOUSE_BTN19" }, - { MP_MOUSE_BTN0_DBL, "MOUSE_BTN0_DBL" }, - { MP_MOUSE_BTN1_DBL, "MOUSE_BTN1_DBL" }, - { MP_MOUSE_BTN2_DBL, "MOUSE_BTN2_DBL" }, - { MP_MOUSE_BTN3_DBL, "MOUSE_BTN3_DBL" }, - { MP_MOUSE_BTN4_DBL, "MOUSE_BTN4_DBL" }, - { MP_MOUSE_BTN5_DBL, "MOUSE_BTN5_DBL" }, - { MP_MOUSE_BTN6_DBL, "MOUSE_BTN6_DBL" }, - { MP_MOUSE_BTN7_DBL, "MOUSE_BTN7_DBL" }, - { MP_MOUSE_BTN8_DBL, "MOUSE_BTN8_DBL" }, - { MP_MOUSE_BTN9_DBL, "MOUSE_BTN9_DBL" }, - { MP_MOUSE_BTN10_DBL, "MOUSE_BTN10_DBL" }, - { MP_MOUSE_BTN11_DBL, "MOUSE_BTN11_DBL" }, - { MP_MOUSE_BTN12_DBL, "MOUSE_BTN12_DBL" }, - { MP_MOUSE_BTN13_DBL, "MOUSE_BTN13_DBL" }, - { MP_MOUSE_BTN14_DBL, "MOUSE_BTN14_DBL" }, - { MP_MOUSE_BTN15_DBL, "MOUSE_BTN15_DBL" }, - { MP_MOUSE_BTN16_DBL, "MOUSE_BTN16_DBL" }, - { MP_MOUSE_BTN17_DBL, "MOUSE_BTN17_DBL" }, - { MP_MOUSE_BTN18_DBL, "MOUSE_BTN18_DBL" }, - { MP_MOUSE_BTN19_DBL, "MOUSE_BTN19_DBL" }, + { MP_MBTN_LEFT, "MBTN_LEFT" }, + { MP_MBTN_MID, "MBTN_MID" }, + { MP_MBTN_RIGHT, "MBTN_RIGHT" }, + { MP_WHEEL_UP, "WHEEL_UP" }, + { MP_WHEEL_DOWN, "WHEEL_DOWN" }, + { MP_WHEEL_LEFT, "WHEEL_LEFT" }, + { MP_WHEEL_RIGHT, "WHEEL_RIGHT" }, + { MP_MBTN_BACK, "MBTN_BACK" }, + { MP_MBTN_FORWARD, "MBTN_FORWARD" }, + { MP_MBTN9, "MBTN9" }, + { MP_MBTN10, "MBTN10" }, + { MP_MBTN11, "MBTN11" }, + { MP_MBTN12, "MBTN12" }, + { MP_MBTN13, "MBTN13" }, + { MP_MBTN14, "MBTN14" }, + { MP_MBTN15, "MBTN15" }, + { MP_MBTN16, "MBTN16" }, + { MP_MBTN17, "MBTN17" }, + { MP_MBTN18, "MBTN18" }, + { MP_MBTN19, "MBTN19" }, + { MP_MBTN_LEFT_DBL, "MBTN_LEFT_DBL" }, + { MP_MBTN_MID_DBL, "MBTN_MID_DBL" }, + { MP_MBTN_RIGHT_DBL, "MBTN_RIGHT_DBL" }, { MP_AR_PLAY, "AR_PLAY" }, { MP_AR_PLAY_HOLD, "AR_PLAY_HOLD" }, @@ -169,6 +152,31 @@ static const struct key_name key_names[] = { { MP_KEY_PREV, "XF86_PREV" }, { MP_KEY_NEXT, "XF86_NEXT" }, + // Deprecated numeric aliases for the mouse buttons + { MP_MBTN_LEFT, "MOUSE_BTN0" }, + { MP_MBTN_MID, "MOUSE_BTN1" }, + { MP_MBTN_RIGHT, "MOUSE_BTN2" }, + { MP_WHEEL_UP, "MOUSE_BTN3" }, + { MP_WHEEL_DOWN, "MOUSE_BTN4" }, + { MP_WHEEL_LEFT, "MOUSE_BTN5" }, + { MP_WHEEL_RIGHT, "MOUSE_BTN6" }, + { MP_MBTN_BACK, "MOUSE_BTN7" }, + { MP_MBTN_FORWARD, "MOUSE_BTN8" }, + { MP_MBTN9, "MOUSE_BTN9" }, + { MP_MBTN10, "MOUSE_BTN10" }, + { MP_MBTN11, "MOUSE_BTN11" }, + { MP_MBTN12, "MOUSE_BTN12" }, + { MP_MBTN13, "MOUSE_BTN13" }, + { MP_MBTN14, "MOUSE_BTN14" }, + { MP_MBTN15, "MOUSE_BTN15" }, + { MP_MBTN16, "MOUSE_BTN16" }, + { MP_MBTN17, "MOUSE_BTN17" }, + { MP_MBTN18, "MOUSE_BTN18" }, + { MP_MBTN19, "MOUSE_BTN19" }, + { MP_MBTN_LEFT_DBL, "MOUSE_BTN0_DBL" }, + { MP_MBTN_MID_DBL, "MOUSE_BTN1_DBL" }, + { MP_MBTN_RIGHT_DBL, "MOUSE_BTN2_DBL" }, + { MP_KEY_CLOSE_WIN, "CLOSE_WIN" }, { MP_KEY_MOUSE_MOVE, "MOUSE_MOVE" }, { MP_KEY_MOUSE_LEAVE, "MOUSE_LEAVE" }, diff --git a/input/keycodes.h b/input/keycodes.h index fe22e8d140..65ff99ddb3 100644 --- a/input/keycodes.h +++ b/input/keycodes.h @@ -98,57 +98,40 @@ #define MP_KEY_KPENTER (MP_KEY_KEYPAD+13) // Mouse events from VOs -#define MP_MOUSE_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP) -#define MP_MOUSE_BTN0 (MP_MOUSE_BASE+0) -#define MP_MOUSE_BTN1 (MP_MOUSE_BASE+1) -#define MP_MOUSE_BTN2 (MP_MOUSE_BASE+2) -#define MP_MOUSE_BTN3 (MP_MOUSE_BASE+3) -#define MP_MOUSE_BTN4 (MP_MOUSE_BASE+4) -#define MP_MOUSE_BTN5 (MP_MOUSE_BASE+5) -#define MP_MOUSE_BTN6 (MP_MOUSE_BASE+6) -#define MP_MOUSE_BTN7 (MP_MOUSE_BASE+7) -#define MP_MOUSE_BTN8 (MP_MOUSE_BASE+8) -#define MP_MOUSE_BTN9 (MP_MOUSE_BASE+9) -#define MP_MOUSE_BTN10 (MP_MOUSE_BASE+10) -#define MP_MOUSE_BTN11 (MP_MOUSE_BASE+11) -#define MP_MOUSE_BTN12 (MP_MOUSE_BASE+12) -#define MP_MOUSE_BTN13 (MP_MOUSE_BASE+13) -#define MP_MOUSE_BTN14 (MP_MOUSE_BASE+14) -#define MP_MOUSE_BTN15 (MP_MOUSE_BASE+15) -#define MP_MOUSE_BTN16 (MP_MOUSE_BASE+16) -#define MP_MOUSE_BTN17 (MP_MOUSE_BASE+17) -#define MP_MOUSE_BTN18 (MP_MOUSE_BASE+18) -#define MP_MOUSE_BTN19 (MP_MOUSE_BASE+19) -#define MP_MOUSE_BTN_END (MP_MOUSE_BASE+20) +#define MP_MOUSE_BASE ((MP_KEY_BASE+0xA0)|MP_NO_REPEAT_KEY|MP_KEY_EMIT_ON_UP) +#define MP_MBTN_LEFT (MP_MOUSE_BASE+0) +#define MP_MBTN_MID (MP_MOUSE_BASE+1) +#define MP_MBTN_RIGHT (MP_MOUSE_BASE+2) +#define MP_WHEEL_UP (MP_MOUSE_BASE+3) +#define MP_WHEEL_DOWN (MP_MOUSE_BASE+4) +#define MP_WHEEL_LEFT (MP_MOUSE_BASE+5) +#define MP_WHEEL_RIGHT (MP_MOUSE_BASE+6) +#define MP_MBTN_BACK (MP_MOUSE_BASE+7) +#define MP_MBTN_FORWARD (MP_MOUSE_BASE+8) +#define MP_MBTN9 (MP_MOUSE_BASE+9) +#define MP_MBTN10 (MP_MOUSE_BASE+10) +#define MP_MBTN11 (MP_MOUSE_BASE+11) +#define MP_MBTN12 (MP_MOUSE_BASE+12) +#define MP_MBTN13 (MP_MOUSE_BASE+13) +#define MP_MBTN14 (MP_MOUSE_BASE+14) +#define MP_MBTN15 (MP_MOUSE_BASE+15) +#define MP_MBTN16 (MP_MOUSE_BASE+16) +#define MP_MBTN17 (MP_MOUSE_BASE+17) +#define MP_MBTN18 (MP_MOUSE_BASE+18) +#define MP_MBTN19 (MP_MOUSE_BASE+19) +#define MP_MOUSE_END (MP_MOUSE_BASE+20) #define MP_KEY_IS_MOUSE_BTN_SINGLE(code) \ - ((code) >= MP_MOUSE_BASE && (code) < MP_MOUSE_BTN_END) - -#define MP_MOUSE_BASE_DBL ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY) -#define MP_MOUSE_BTN0_DBL (MP_MOUSE_BASE_DBL+0) -#define MP_MOUSE_BTN1_DBL (MP_MOUSE_BASE_DBL+1) -#define MP_MOUSE_BTN2_DBL (MP_MOUSE_BASE_DBL+2) -#define MP_MOUSE_BTN3_DBL (MP_MOUSE_BASE_DBL+3) -#define MP_MOUSE_BTN4_DBL (MP_MOUSE_BASE_DBL+4) -#define MP_MOUSE_BTN5_DBL (MP_MOUSE_BASE_DBL+5) -#define MP_MOUSE_BTN6_DBL (MP_MOUSE_BASE_DBL+6) -#define MP_MOUSE_BTN7_DBL (MP_MOUSE_BASE_DBL+7) -#define MP_MOUSE_BTN8_DBL (MP_MOUSE_BASE_DBL+8) -#define MP_MOUSE_BTN9_DBL (MP_MOUSE_BASE_DBL+9) -#define MP_MOUSE_BTN10_DBL (MP_MOUSE_BASE_DBL+10) -#define MP_MOUSE_BTN11_DBL (MP_MOUSE_BASE_DBL+11) -#define MP_MOUSE_BTN12_DBL (MP_MOUSE_BASE_DBL+12) -#define MP_MOUSE_BTN13_DBL (MP_MOUSE_BASE_DBL+13) -#define MP_MOUSE_BTN14_DBL (MP_MOUSE_BASE_DBL+14) -#define MP_MOUSE_BTN15_DBL (MP_MOUSE_BASE_DBL+15) -#define MP_MOUSE_BTN16_DBL (MP_MOUSE_BASE_DBL+16) -#define MP_MOUSE_BTN17_DBL (MP_MOUSE_BASE_DBL+17) -#define MP_MOUSE_BTN18_DBL (MP_MOUSE_BASE_DBL+18) -#define MP_MOUSE_BTN19_DBL (MP_MOUSE_BASE_DBL+19) -#define MP_MOUSE_BTN_DBL_END (MP_MOUSE_BASE_DBL+20) + ((code) >= MP_MOUSE_BASE && (code) < MP_MOUSE_END) + +#define MP_MOUSE_DBL_BASE ((MP_KEY_BASE+0xC0)|MP_NO_REPEAT_KEY) +#define MP_MBTN_LEFT_DBL (MP_MOUSE_DBL_BASE+0) +#define MP_MBTN_MID_DBL (MP_MOUSE_DBL_BASE+1) +#define MP_MBTN_RIGHT_DBL (MP_MOUSE_DBL_BASE+2) +#define MP_MOUSE_DBL_END (MP_MOUSE_DBL_BASE+20) #define MP_KEY_IS_MOUSE_BTN_DBL(code) \ - ((code) >= MP_MOUSE_BTN0_DBL && (code) < MP_MOUSE_BTN_DBL_END) + ((code) >= MP_MOUSE_DBL_BASE && (code) < MP_MOUSE_DBL_END) // Apple Remote input module #define MP_AR_BASE (MP_KEY_BASE+0xE0) |