From 3e1aed8f40f0c35f78c74502050630519895c972 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 23 Dec 2015 19:10:38 +0100 Subject: input: add key name to script-binding command response The "script-binding" command is used by the Lua scripting wrapper to register key bindings on the fly. It's also the only way to get fine- grained information about key events (such as separate key up/down events). This information is sent via a "key-binding" message when the state of a key changes. Extend it to send name of the mapped key itself. Previously, it was assumed that the user just uses an unique identifier for the binding's name, so it wasn't needed. With this change, a user can map exactly the same command to multiple keys, which is useful especially with the next commit. Part of #2612. --- DOCS/man/input.rst | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'DOCS') diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 00c3a007dd..e3fbddd778 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -647,14 +647,20 @@ Input Commands that are Possibly Subject to Change For completeness, here is how this command works internally. The details could change any time. On any matching key event, ``script_message_to`` or ``script_message`` is called (depending on whether the script name is - included), where the first argument is the string ``key-binding``, the - second argument is the name of the binding, and the third argument is the - key state as string. The key state consists of a number of letters. The - first letter is one of ``d`` (key was pressed down), ``u`` (was released), - ``r`` (key is still down, and was repeated; only if key repeat is enabled - for this binding), ``p`` (key was pressed; happens if up/down can't be - tracked). The second letter whether the event originates from the mouse, - either ``m`` (mouse button) or ``-`` (something else). + included), with the following arguments: + + 1. The string ``key-binding``. + 2. The name of the binding (as established above). + 3. The key state as string (see below). + 4. The key name (since mpv 0.15.0). + + The key state consists of 2 letters: + + 1. One of ``d`` (key was pressed down), ``u`` (was released), ``r`` (key + is still down, and was repeated; only if key repeat is enabled for this + binding), ``p`` (key was pressed; happens if up/down can't be tracked). + 2. Whether the event originates from the mouse, either ``m`` (mouse button) + or ``-`` (something else). ``ab-loop`` Cycle through A-B loop states. The first command will set the ``A`` point -- cgit v1.2.3