mirror of https://github.com/mpv-player/mpv
js: report key name for "complex" key bindings - match b08c8f50
This commit is contained in:
parent
da13a3b231
commit
14971424b9
|
@ -177,10 +177,10 @@ mp.abort_async_command = function abort_async_command(id) {
|
|||
// {cb: fn, forced: bool, maybe input: str, repeatable: bool, complex: bool}
|
||||
var binds = new_cache();
|
||||
|
||||
function dispatch_key_binding(name, state) {
|
||||
function dispatch_key_binding(name, state, key_name) {
|
||||
var cb = binds[name] ? binds[name].cb : false;
|
||||
if (cb) // "script-binding [<script_name>/]<name>" command was invoked
|
||||
cb(state);
|
||||
cb(state, key_name);
|
||||
}
|
||||
|
||||
function update_input_sections() {
|
||||
|
@ -217,10 +217,11 @@ function add_binding(forced, key, name, fn, opts) {
|
|||
fn({event: "press", is_mouse: false});
|
||||
});
|
||||
var KEY_STATES = { u: "up", d: "down", r: "repeat", p: "press" };
|
||||
key_data.cb = function key_cb(state) {
|
||||
key_data.cb = function key_cb(state, key_name) {
|
||||
fn({
|
||||
event: KEY_STATES[state[0]] || "unknown",
|
||||
is_mouse: state[1] == "m"
|
||||
is_mouse: state[1] == "m",
|
||||
key: key_name || undefined
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue