From 799d3d4557e3655f9a373b6a7009790d3fa92e70 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Thu, 23 Jul 2020 15:35:56 +0300 Subject: 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. --- player/command.h | 1 + player/playloop.c | 4 ++++ 2 files changed, 5 insertions(+) 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) -- cgit v1.2.3