summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_repeat_key.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_repeat_key.h')
-rw-r--r--quantum/process_keycode/process_repeat_key.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_repeat_key.h b/quantum/process_keycode/process_repeat_key.h
new file mode 100644
index 0000000000..eddc50f254
--- /dev/null
+++ b/quantum/process_keycode/process_repeat_key.h
@@ -0,0 +1,62 @@
1// Copyright 2022-2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include "quantum.h"
18
19/**
20 * @brief Process handler for remembering the last key.
21 *
22 * @param keycode Keycode registered by matrix press, per keymap
23 * @param record keyrecord_t structure
24 * @return true Continue processing keycodes, and send to host
25 * @return false Stop processing keycodes, and don't send to host
26 */
27bool process_last_key(uint16_t keycode, keyrecord_t* record);
28
29/**
30 * @brief Optional callback defining which keys are remembered.
31 *
32 * @param keycode Keycode that was just pressed
33 * @param record keyrecord_t structure
34 * @param remembered_mods Mods that will be remembered with this key
35 * @return true Key is remembered
36 * @return false Key is ignored
37 *
38 * Modifier and layer switch keys are always ignored. For all other keys, this
39 * callback is called on every key press. Returning true means that the key is
40 * remembered, false means it is ignored. By default, all non-modifier,
41 * non-layer switch keys are remembered.
42 *
43 * The `remembered_mods` arg represents the mods that will be remembered with
44 * this key. It can be modified to forget certain mods, for instance to forget
45 * capitalization when repeating shifted letters:
46 *
47 * // Forget Shift on letter keys.
48 * if (KC_A <= keycode && keycode <= KC_Z && (*remembered_mods & ~MOD_MASK_SHIFT) == 0) {
49 * *remembered_mods = 0;
50 * }
51 */
52bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods);
53
54/**
55 * @brief Process handler for Repeat Key feature.
56 *
57 * @param keycode Keycode registered by matrix press, per keymap
58 * @param record keyrecord_t structure
59 * @return true Continue processing keycodes, and send to host
60 * @return false Stop processing keycodes, and don't send to host
61 */
62bool process_repeat_key(uint16_t keycode, keyrecord_t* record);