qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

process_repeat_key.h (2502B)


      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 <stdint.h>
     18 #include <stdbool.h>
     19 #include "action.h"
     20 
     21 /**
     22  * @brief Process handler for remembering the last key.
     23  *
     24  * @param keycode  Keycode registered by matrix press, per keymap
     25  * @param record   keyrecord_t structure
     26  * @return true    Continue processing keycodes, and send to host
     27  * @return false   Stop processing keycodes, and don't send to host
     28  */
     29 bool process_last_key(uint16_t keycode, keyrecord_t* record);
     30 
     31 /**
     32  * @brief Optional callback defining which keys are remembered.
     33  *
     34  * @param keycode          Keycode that was just pressed
     35  * @param record           keyrecord_t structure
     36  * @param remembered_mods  Mods that will be remembered with this key
     37  * @return true            Key is remembered
     38  * @return false           Key is ignored
     39  *
     40  * Modifier and layer switch keys are always ignored. For all other keys, this
     41  * callback is called on every key press. Returning true means that the key is
     42  * remembered, false means it is ignored. By default, all non-modifier,
     43  * non-layer switch keys are remembered.
     44  *
     45  * The `remembered_mods` arg represents the mods that will be remembered with
     46  * this key. It can be modified to forget certain mods, for instance to forget
     47  * capitalization when repeating shifted letters:
     48  *
     49  *     // Forget Shift on letter keys.
     50  *     if (KC_A <= keycode && keycode <= KC_Z && (*remembered_mods & ~MOD_MASK_SHIFT) == 0) {
     51  *         *remembered_mods = 0;
     52  *     }
     53  */
     54 bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods);
     55 
     56 /**
     57  * @brief Process handler for Repeat Key feature.
     58  *
     59  * @param keycode  Keycode registered by matrix press, per keymap
     60  * @param record   keyrecord_t structure
     61  * @return true    Continue processing keycodes, and send to host
     62  * @return false   Stop processing keycodes, and don't send to host
     63  */
     64 bool process_repeat_key(uint16_t keycode, keyrecord_t* record);