mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
input: Allow repeat filtering to be disabled
Generally the input library handles processing of a list of scanned keys. Repeated keys need to be generated based on a timer in this case, since all that is provided is a list of keys current depressed. Keyboards which do their own scanning will resend codes when they want to inject a repeating key. Provide a function which tells the input library to accept repeating keys and not to try to second-guess the caller. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -413,8 +413,8 @@ static int _input_send_keycodes(struct input_config *config, int keycode[],
|
|||||||
* insert another character if we later realise that we
|
* insert another character if we later realise that we
|
||||||
* have missed a repeat slot.
|
* have missed a repeat slot.
|
||||||
*/
|
*/
|
||||||
is_repeat = config->repeat_rate_ms &&
|
is_repeat = config->allow_repeats || (config->repeat_rate_ms &&
|
||||||
(int)get_timer(config->next_repeat_ms) >= 0;
|
(int)get_timer(config->next_repeat_ms) >= 0);
|
||||||
if (!is_repeat)
|
if (!is_repeat)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -495,6 +495,11 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms,
|
|||||||
config->repeat_rate_ms = repeat_rate_ms;
|
config->repeat_rate_ms = repeat_rate_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_allow_repeats(struct input_config *config, bool allow_repeats)
|
||||||
|
{
|
||||||
|
config->allow_repeats = allow_repeats;
|
||||||
|
}
|
||||||
|
|
||||||
int input_add_tables(struct input_config *config)
|
int input_add_tables(struct input_config *config)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@@ -57,6 +57,7 @@ struct input_config {
|
|||||||
* unknown
|
* unknown
|
||||||
*/
|
*/
|
||||||
int (*read_keys)(struct input_config *config);
|
int (*read_keys)(struct input_config *config);
|
||||||
|
bool allow_repeats; /* Don't filter out repeats */
|
||||||
unsigned int next_repeat_ms; /* Next time we repeat a key */
|
unsigned int next_repeat_ms; /* Next time we repeat a key */
|
||||||
unsigned int repeat_delay_ms; /* Time before autorepeat starts */
|
unsigned int repeat_delay_ms; /* Time before autorepeat starts */
|
||||||
unsigned int repeat_rate_ms; /* Autorepeat rate in ms */
|
unsigned int repeat_rate_ms; /* Autorepeat rate in ms */
|
||||||
@@ -142,6 +143,24 @@ int input_stdio_register(struct stdio_dev *dev);
|
|||||||
void input_set_delays(struct input_config *config, int repeat_delay_ms,
|
void input_set_delays(struct input_config *config, int repeat_delay_ms,
|
||||||
int repeat_rate_ms);
|
int repeat_rate_ms);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell the input layer whether to allow the caller to determine repeats
|
||||||
|
*
|
||||||
|
* Generally the input library handles processing of a list of scanned keys.
|
||||||
|
* Repeated keys need to be generated based on a timer in this case, since all
|
||||||
|
* that is provided is a list of keys current depressed.
|
||||||
|
*
|
||||||
|
* Keyboards which do their own scanning will resend codes when they want to
|
||||||
|
* inject a repeating key. This function can be called at start-up to select
|
||||||
|
* this behaviour.
|
||||||
|
*
|
||||||
|
* @param config Input state
|
||||||
|
* @param allow_repeats true to repeat depressed keys every time
|
||||||
|
* input_send_keycodes() is called, false to do normal
|
||||||
|
* keyboard repeat processing with a timer.
|
||||||
|
*/
|
||||||
|
void input_allow_repeats(struct input_config *config, bool allow_repeats);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the key map tables
|
* Set up the key map tables
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user