mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
input: minor simplification for --input-test
This commit is contained in:
@@ -311,8 +311,7 @@ static void append_bind_info(struct input_ctx *ictx, char **pmsg,
|
|||||||
static mp_cmd_t *handle_test(struct input_ctx *ictx, int n, int *keys)
|
static mp_cmd_t *handle_test(struct input_ctx *ictx, int n, int *keys)
|
||||||
{
|
{
|
||||||
char *key_buf = mp_input_get_key_combo_name(keys, n);
|
char *key_buf = mp_input_get_key_combo_name(keys, n);
|
||||||
// "$>" to disable property substitution when invoking "show_text"
|
char *msg = talloc_asprintf(NULL, "Key %s is bound to:\n", key_buf);
|
||||||
char *msg = talloc_asprintf(NULL, "$>Key %s is bound to:\n", key_buf);
|
|
||||||
talloc_free(key_buf);
|
talloc_free(key_buf);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -333,9 +332,9 @@ static mp_cmd_t *handle_test(struct input_ctx *ictx, int n, int *keys)
|
|||||||
msg = talloc_asprintf_append(msg, "(nothing)");
|
msg = talloc_asprintf_append(msg, "(nothing)");
|
||||||
|
|
||||||
MP_VERBOSE(ictx, "%s\n", msg);
|
MP_VERBOSE(ictx, "%s\n", msg);
|
||||||
|
const char *args[] = {"show_text", msg, NULL};
|
||||||
mp_cmd_t *res = mp_input_parse_cmd(ictx, bstr0("show_text \"\""), "");
|
mp_cmd_t *res = mp_input_parse_cmd_strv(ictx->log, MP_ON_OSD_MSG, args, "");
|
||||||
res->args[0].v.s = talloc_steal(res, msg);
|
talloc_free(msg);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user