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.
This commit is contained in:
Avi Halachmi (:avih) 2020-07-23 15:35:56 +03:00 committed by avih
parent 26fc70dbfd
commit 799d3d4557
2 changed files with 5 additions and 0 deletions

View File

@ -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);

View File

@ -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)