From 787acfb8e5e0b9a8eeabbf75b3b481127c74b97d Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Wed, 8 Jul 2020 16:19:46 -0600 Subject: [PATCH] kbscan: Disable key repeat for certain SCI keys --- src/board/system76/common/kbscan.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/board/system76/common/kbscan.c b/src/board/system76/common/kbscan.c index ed94ec3..c0320d5 100644 --- a/src/board/system76/common/kbscan.c +++ b/src/board/system76/common/kbscan.c @@ -215,6 +215,22 @@ bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) { return true; } +static inline bool key_should_repeat(uint16_t key) { + switch (key) { + case K_TOUCHPAD: + case (KT_SCI | SCI_AIRPLANE_MODE): + case (KT_SCI | SCI_CAMERA_TOGGLE): + case (KT_SCI | SCI_DISPLAY_TOGGLE): + case (KT_SCI | SCI_SUSPEND): + case (KT_SCI_EXTRA | SCI_EXTRA_KBD_BKL): + case (KT_SCI_EXTRA | SCI_EXTRA_KBD_COLOR): + case (KT_SCI_EXTRA | SCI_EXTRA_KBD_TOGGLE): + return false; + } + + return true; +} + void kbscan_event(void) { static uint8_t kbscan_layer = 0; uint8_t layer = kbscan_layer; @@ -311,7 +327,7 @@ void kbscan_event(void) { } kbscan_last[i] = new; - } else if (new && repeat_key != 0) { + } else if (new && repeat_key != 0 && key_should_repeat(repeat_key)) { // A key is being pressed uint32_t time = time_get(); static uint32_t repeat_start = 0;