diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-07-23 15:35:56 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2020-11-16 20:29:58 +0200 |
commit | 799d3d4557e3655f9a373b6a7009790d3fa92e70 (patch) | |
tree | 7a7418e62c1d855e53cf8479622da5884df0e60d | |
parent | 26fc70dbfdb11844497f34e2d96ecd6a011cd6bc (diff) | |
download | mpv-799d3d4557e3655f9a373b6a7009790d3fa92e70.tar.bz2 mpv-799d3d4557e3655f9a373b6a7009790d3fa92e70.tar.xz |
command: add internal INPUT_PROCESSED event
Fires after a non-empty input queue was processed.
Currently yet unused, but the next commit will use it.
-rw-r--r-- | player/command.h | 1 | ||||
-rw-r--r-- | player/playloop.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/player/command.h b/player/command.h index c47ed40f1d..b45e616497 100644 --- a/player/command.h +++ b/player/command.h @@ -102,6 +102,7 @@ enum { MP_EVENT_CHANGE_PLAYLIST, MP_EVENT_CORE_IDLE, MP_EVENT_DURATION_UPDATE, + MP_EVENT_INPUT_PROCESSED, }; bool mp_hook_test_completion(struct MPContext *mpctx, char *type); diff --git a/player/playloop.c b/player/playloop.c index 6cff3c9108..87c8b6390c 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -110,13 +110,17 @@ void mp_core_unlock(struct MPContext *mpctx) // Process any queued user input. static void mp_process_input(struct MPContext *mpctx) { + int processed = 0; for (;;) { mp_cmd_t *cmd = mp_input_read_cmd(mpctx->input); if (!cmd) break; run_command(mpctx, cmd, NULL, NULL, NULL); + processed = 1; } mp_set_timeout(mpctx, mp_input_get_delay(mpctx->input)); + if (processed) + mp_notify(mpctx, MP_EVENT_INPUT_PROCESSED, NULL); } double get_relative_time(struct MPContext *mpctx) |