diff options
author | tmk <nobody@nowhere> | 2013-10-02 17:49:25 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2013-10-03 12:40:33 +0900 |
commit | 8819cf6bb1da487de9bef9b01ee434fbdf710d4d (patch) | |
tree | cd15000fb03aaef3d4e83095c87061c1794da1c2 /common/keyboard.h | |
parent | a0f9c1fb4fc86c37353b5298c7a4d8d68b368d8c (diff) |
Fix Tapping: release key immediately but modifier #65
- See https://github.com/tmk/tmk_keyboard/issues/60
- **Except for modifiers** a key pressed before the tapping starts should be released immediately
- 'Mod-Tap key'(like shift-;) didn't work from this fix: 4d0b3aa Fix Tapping: release of a key pressed before tap
This key sequence should register ':', not ';'. With the fix Shift is
released before settlement of tapping, this registers ';'.
Shift ~~___~~~~~~~
;(Tap) ~~~____~~~~
Diffstat (limited to 'common/keyboard.h')
-rw-r--r-- | common/keyboard.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/common/keyboard.h b/common/keyboard.h index 78cb24034f..d1a922420b 100644 --- a/common/keyboard.h +++ b/common/keyboard.h @@ -42,16 +42,15 @@ typedef struct { /* equivalent test of key_t */ #define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col) -/* (time == 0) means no event and assumes matrix has no 255 line. */ -#define IS_NOEVENT(event) ((event).time == 0 || ((event).key.row == 255 && (event).key.col == 255)) - -#define NOEVENT (keyevent_t){ \ - .key = (key_t){ .row = 255, .col = 255 }, \ - .pressed = false, \ - .time = 0 \ -} - -/* tick event */ +/* Rules for No Event: + * 1) (time == 0) to handle (keyevent_t){} as empty event + * 2) Matrix(255, 255) to make TICK event available + */ +static inline bool IS_NOEVENT(keyevent_t event) { return event.time == 0 || (event.key.row == 255 && event.key.col == 255); } +static inline bool IS_PRESSED(keyevent_t event) { return (!IS_NOEVENT(event) && event.pressed); } +static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) && !event.pressed); } + +/* Tick event */ #define TICK (keyevent_t){ \ .key = (key_t){ .row = 255, .col = 255 }, \ .pressed = false, \ |