diff options
author | wm4 <wm4@nowhere> | 2014-09-13 01:02:09 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-13 01:14:07 +0200 |
commit | fc5df2b970e180851aec2af71129a13a49dc56fd (patch) | |
tree | a0b6fdea1523bd0f482b1c697621ffd9cc3313ec /input/input.c | |
parent | f93dd45ac162c7e1dfcd177b791f7dc6130c94f3 (diff) | |
download | mpv-fc5df2b970e180851aec2af71129a13a49dc56fd.tar.bz2 mpv-fc5df2b970e180851aec2af71129a13a49dc56fd.tar.xz |
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.
Diffstat (limited to 'input/input.c')
-rw-r--r-- | input/input.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); } } |