summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-14 22:22:33 +0200
committerwm4 <wm4@nowhere>2020-05-14 22:22:33 +0200
commita58b2df3f84da9c19e4900e2524036a176c16c7a (patch)
tree78eff7220527e9682e72ca6394553ef74a3081ca /input
parentc6369933f1d9cd204b09be95ef7d4ed1351610e2 (diff)
downloadmpv-a58b2df3f84da9c19e4900e2524036a176c16c7a.tar.bz2
mpv-a58b2df3f84da9c19e4900e2524036a176c16c7a.tar.xz
command: add input-key-list property
Fixes: #7698
Diffstat (limited to 'input')
-rw-r--r--input/keycodes.c10
-rw-r--r--input/keycodes.h1
2 files changed, 11 insertions, 0 deletions
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 */