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.
This commit is contained in:
wm4 2014-09-13 01:13:36 +02:00
parent b0a3d38b4c
commit 8bf57b8192
1 changed files with 9 additions and 8 deletions

View File

@ -973,18 +973,19 @@ void idle_loop(struct MPContext *mpctx)
{
if (need_reinit) {
mp_notify(mpctx, MPV_EVENT_IDLE, NULL);
handle_force_window(mpctx, true);
}
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);
handle_force_window(mpctx, true);
mpctx->sleeptime = 0;
need_reinit = false;
}
handle_dummy_ticks(mpctx);
mp_wait_events(mpctx, mpctx->sleeptime);
mpctx->sleeptime = 100.0;
mp_process_input(mpctx);
update_osd_msg(mpctx);
handle_osd_redraw(mpctx);
}
}