diff options
author | wm4 <wm4@nowhere> | 2014-04-18 18:13:58 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-18 18:15:41 +0200 |
commit | 3ded6077ae325f1c14ba347ec72e208fcd22abb9 (patch) | |
tree | ae49e18cc068fd0723aa180a60b12c9ed5c6b7e2 /input | |
parent | 395fd9aded9e7b5f6ca7e4ccd33a9a17a9131fe1 (diff) |
input: don't wakeup core if key repeat is requested but not possible
There's no need to wakeup the core in this situation.
Diffstat (limited to 'input')
-rw-r--r-- | input/input.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/input/input.c b/input/input.c index d7844a79c9..01c97c4c8b 100644 --- a/input/input.c +++ b/input/input.c @@ -1012,7 +1012,7 @@ static void input_wait_read(struct input_ctx *ictx, int time) */ static void read_events(struct input_ctx *ictx, int time) { - if (ictx->last_key_down && ictx->ar_rate > 0) { + 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); } @@ -1057,8 +1057,10 @@ int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t *cmd) static mp_cmd_t *check_autorepeat(struct input_ctx *ictx) { // No input : autorepeat ? - if (ictx->ar_rate > 0 && ictx->ar_state >= 0 && ictx->last_key_down - && !(ictx->last_key_down & MP_NO_REPEAT_KEY)) { + if (ictx->ar_rate <= 0 || !ictx->current_down_cmd || !ictx->last_key_down || + (ictx->last_key_down & MP_NO_REPEAT_KEY)) + ictx->ar_state = -1; // disable + if (ictx->ar_state >= 0) { int64_t t = mp_time_us(); if (ictx->last_ar + 2000000 < t) ictx->last_ar = t; @@ -1066,10 +1068,6 @@ static mp_cmd_t *check_autorepeat(struct input_ctx *ictx) if (ictx->ar_state == 0 && (t - ictx->last_key_down_time) >= ictx->ar_delay * 1000) { - if (!ictx->current_down_cmd) { - ictx->ar_state = -1; - return NULL; - } ictx->ar_state = 1; ictx->last_ar = ictx->last_key_down_time + ictx->ar_delay * 1000; return mp_cmd_clone(ictx->current_down_cmd); |