forked from mirrors/qmk_userspace
Fix #156: clear weak mods on every key press
- new macro_mods bit field for mods applied by macros - weak_mods now only used for ACT_{L,R}MODS (i.e. LSFT, RSFT, LCTL etc.) - clear the _weak_ mods on every key *pressed* such that LSFT etc. can no more interfere with the next key
This commit is contained in:
parent
7d3ebd7b40
commit
b7a81f0419
4 changed files with 23 additions and 2 deletions
|
@ -29,6 +29,7 @@ static inline void del_key_bit(uint8_t code);
|
|||
|
||||
static uint8_t real_mods = 0;
|
||||
static uint8_t weak_mods = 0;
|
||||
static uint8_t macro_mods = 0;
|
||||
|
||||
#ifdef USB_6KRO_ENABLE
|
||||
#define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS)
|
||||
|
@ -55,6 +56,7 @@ static int16_t oneshot_time = 0;
|
|||
void send_keyboard_report(void) {
|
||||
keyboard_report->mods = real_mods;
|
||||
keyboard_report->mods |= weak_mods;
|
||||
keyboard_report->mods |= macro_mods;
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
if (oneshot_mods) {
|
||||
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
|
||||
|
@ -118,6 +120,13 @@ void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; }
|
|||
void set_weak_mods(uint8_t mods) { weak_mods = mods; }
|
||||
void clear_weak_mods(void) { weak_mods = 0; }
|
||||
|
||||
/* macro modifier */
|
||||
uint8_t get_macro_mods(void) { return macro_mods; }
|
||||
void add_macro_mods(uint8_t mods) { macro_mods |= mods; }
|
||||
void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; }
|
||||
void set_macro_mods(uint8_t mods) { macro_mods = mods; }
|
||||
void clear_macro_mods(void) { macro_mods = 0; }
|
||||
|
||||
/* Oneshot modifier */
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
void set_oneshot_mods(uint8_t mods)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue