summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-13 01:13:36 +0200
committerwm4 <wm4@nowhere>2014-09-13 01:14:07 +0200
commit8bf57b8192a81a72dbd186e328f9f4b651ce8f6e (patch)
tree59d6ed1300d8a1b3f4221a0f4db9345c1085a7da /player/playloop.c
parentb0a3d38b4c30001c1f42948cf6fd4ef761f8d665 (diff)
downloadmpv-8bf57b8192a81a72dbd186e328f9f4b651ce8f6e.tar.bz2
mpv-8bf57b8192a81a72dbd186e328f9f4b651ce8f6e.tar.xz
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.
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c17
1 files changed, 9 insertions, 8 deletions
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);
}
}