mod_lock.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. /*
  3. Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com>
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #include USERSPACE_H
  16. typedef struct {
  17. bool locking;
  18. uint16_t mod;
  19. uint16_t trigger;
  20. } mod_lock_state_t;
  21. extern mod_lock_state_t mod_lock_states[];
  22. extern uint8_t NUM_MODLOCK_STATES;
  23. // Custom mod-locking functionality that registers the mod and
  24. // keeps it registered until the trigger key is tapped again
  25. // or until a specified cancel key is tapped.
  26. void process_mod_lock(uint16_t keycode, keyrecord_t *record);
  27. bool is_mod_lock_cancel_key(uint16_t keycode);
  28. #undef IGNORE_KC
  29. #define IGNORE_KC(KC) \
  30. case KC: