From a58b2df3f84da9c19e4900e2524036a176c16c7a Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 14 May 2020 22:22:33 +0200 Subject: command: add input-key-list property Fixes: #7698 --- input/keycodes.c | 10 ++++++++++ input/keycodes.h | 1 + 2 files changed, 11 insertions(+) (limited to 'input') diff --git a/input/keycodes.c b/input/keycodes.c index bb92994479..312ffc4893 100644 --- a/input/keycodes.c +++ b/input/keycodes.c @@ -322,6 +322,16 @@ void mp_print_key_list(struct mp_log *out) mp_info(out, "%s\n", key_names[i].name); } +char **mp_get_key_list(void) +{ + char **list = NULL; + int num = 0; + for (int i = 0; key_names[i].name != NULL; i++) + MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(NULL, key_names[i].name)); + MP_TARRAY_APPEND(NULL, list, num, NULL); + return list; +} + int mp_normalize_keycode(int keycode) { if (keycode <= 0) diff --git a/input/keycodes.h b/input/keycodes.h index 3a33258031..6373a6e21a 100644 --- a/input/keycodes.h +++ b/input/keycodes.h @@ -253,5 +253,6 @@ int mp_input_get_keys_from_string(char *str, int max_num_keys, struct mp_log; void mp_print_key_list(struct mp_log *out); +char **mp_get_key_list(void); #endif /* MPLAYER_KEYCODES_H */ -- cgit v1.2.3