From fc5df2b970e180851aec2af71129a13a49dc56fd Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 13 Sep 2014 01:02:09 +0200 Subject: input: fix autorepeat Mismatching units in timeout calculation. Also, as a near-cosmetic change, explicitly wake up the core on the right time. Currently this does nothing, because the core is woken up anyway - but it will matter with the next commit. --- input/input.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'input') diff --git a/input/input.c b/input/input.c index 5415b369d7..aec78a7c0e 100644 --- a/input/input.c +++ b/input/input.c @@ -607,6 +607,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale) ictx->ar_state = 0; ictx->current_down_cmd = mp_cmd_clone(cmd); ictx->current_down_cmd_need_release = false; + mp_input_wakeup(ictx); // possibly start timer for autorepeat } else if (state == MP_KEY_STATE_UP) { // Most VOs send RELEASE_ALL anyway release_down_cmd(ictx, false); @@ -792,8 +793,8 @@ unsigned int mp_input_get_mouse_event_counter(struct input_ctx *ictx) static void adjust_max_wait_time(struct input_ctx *ictx, double *time) { if (ictx->last_key_down && ictx->ar_rate > 0 && ictx->ar_state >= 0) { - *time = FFMIN(*time, 1000 / ictx->ar_rate); - *time = FFMIN(*time, ictx->ar_delay); + *time = FFMIN(*time, 1.0 / ictx->ar_rate); + *time = FFMIN(*time, ictx->ar_delay / 1000.0); } } -- cgit v1.2.3