From 8bf57b8192a81a72dbd186e328f9f4b651ce8f6e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 13 Sep 2014 01:13:36 +0200 Subject: player: fix idle mode event handling Idle mode went to sleep too early, e.g. just pressing "ESC" did nothing, until the next event happened. This was because it directly went to sleep after processing commands. What we should do instead is rechecking all state after processing commands, redraw OSD, and then go to sleep. This also fixes some strange OSD-related behavior. Also move some other code around to separate idle mode initialization from the normal run loop. --- player/playloop.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'player') diff --git a/player/playloop.c b/player/playloop.c index d6451083ac..31bf58e722 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -973,18 +973,19 @@ void idle_loop(struct MPContext *mpctx) { if (need_reinit) { mp_notify(mpctx, MPV_EVENT_IDLE, NULL); + int uninit = INITIALIZED_AO; + if (!mpctx->opts->force_vo) + uninit |= INITIALIZED_VO; + uninit_player(mpctx, uninit); handle_force_window(mpctx, true); + mpctx->sleeptime = 0; + need_reinit = false; } - need_reinit = false; handle_dummy_ticks(mpctx); - int uninit = INITIALIZED_AO; - if (!mpctx->opts->force_vo) - uninit |= INITIALIZED_VO; - uninit_player(mpctx, uninit); - update_osd_msg(mpctx); - handle_osd_redraw(mpctx); - mp_process_input(mpctx); mp_wait_events(mpctx, mpctx->sleeptime); mpctx->sleeptime = 100.0; + mp_process_input(mpctx); + update_osd_msg(mpctx); + handle_osd_redraw(mpctx); } } -- cgit v1.2.3