mirror of
https://github.com/mpv-player/mpv
synced 2024-11-18 21:16:10 +01:00
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:
parent
b0a3d38b4c
commit
8bf57b8192
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user