diff options
author | wm4 <wm4@nowhere> | 2019-11-23 00:39:07 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-23 01:18:49 +0100 |
commit | f379cf0bf89ca369e6cea957ef20e9e6579ec230 (patch) | |
tree | f69961fb3f6e23370d168d818a5db862949e43b6 /player/command.c | |
parent | 251069d9ea481c14e418a63bfb2a471314fd4764 (diff) | |
download | mpv-f379cf0bf89ca369e6cea957ef20e9e6579ec230.tar.bz2 mpv-f379cf0bf89ca369e6cea957ef20e9e6579ec230.tar.xz |
command, input: add input-bindings property
Read-only information about all bindings. Somewhat hoping someone can
make a nice GUI-like overlay thing for it, which provides information
about mapped keys.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c index d667eb844f..e640ba933e 100644 --- a/player/command.c +++ b/player/command.c @@ -3505,6 +3505,22 @@ static int mp_property_commands(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } +static int mp_property_bindings(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + switch (action) { + case M_PROPERTY_GET_TYPE: + *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE}; + return M_PROPERTY_OK; + case M_PROPERTY_GET: { + *(struct mpv_node *)arg = mp_input_get_bindings(mpctx->input); + return M_PROPERTY_OK; + } + } + return M_PROPERTY_NOT_IMPLEMENTED; +} + // Redirect a property name to another #define M_PROPERTY_ALIAS(name, real_property) \ {(name), mp_property_alias, .priv = (real_property)} @@ -3691,6 +3707,7 @@ static const struct m_property mp_properties_base[] = { {"property-list", mp_property_list}, {"profile-list", mp_profile_list}, {"command-list", mp_property_commands}, + {"input-bindings", mp_property_bindings}, {"play-dir", mp_property_play_direction}, @@ -5806,7 +5823,7 @@ static void cmd_dump_cache_ab(void *p) * command has an arbitrary number of arguments, all using the type indicated by * the last argument (they are appended to mp_cmd.args[] starting at the last * argument's index). - * Arguments have named, which can be used by named argument functions, e.g. in + * Arguments have names, which can be used by named argument functions, e.g. in * Lua with mp.command_native(). */ |