mirror of https://github.com/mpv-player/mpv
command: add canceled state to key-binding client message
This allows libmpv clients to know whether the key binding is canceled and thus should normally be ignored.
This commit is contained in:
parent
de97cb0964
commit
5fcbe1c417
|
@ -1344,13 +1344,16 @@ Input Commands that are Possibly Subject to Change
|
|||
key with a letter is normally not emitted as having a modifier, and results
|
||||
in upper case text instead, but some backends may mess up).
|
||||
|
||||
The key state consists of 2 characters:
|
||||
The key state consists of 3 characters:
|
||||
|
||||
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).
|
||||
3. Whether the event results from a cancellation (e.g. the key is logically
|
||||
released but not physically released), either ``c`` (canceled) or ``-``
|
||||
(something else). Not all types of cancellations set this flag.
|
||||
|
||||
Future versions can add more arguments and more key state characters to
|
||||
support more input peculiarities.
|
||||
|
|
|
@ -6342,7 +6342,8 @@ static void cmd_script_binding(void *p)
|
|||
target = space;
|
||||
name = sep + 1;
|
||||
}
|
||||
char state[3] = {'p', incmd->is_mouse_button ? 'm' : '-'};
|
||||
char state[4] = {'p', incmd->is_mouse_button ? 'm' : '-',
|
||||
incmd->canceled ? 'c' : '-'};
|
||||
if (incmd->is_up_down)
|
||||
state[0] = incmd->repeated ? 'r' : (incmd->is_up ? 'u' : 'd');
|
||||
event.num_args = 5;
|
||||
|
|
Loading…
Reference in New Issue