Skip to content

Commit

Permalink
core: Fix is_tap_key() #673
Browse files Browse the repository at this point in the history
System and media control keys work well with
ACTION_MODS_TAP_KEY and ACTION_LAYER_TAP_KEY now.
  • Loading branch information
tmk committed Feb 8, 2021
1 parent 79c987d commit 1b3fe95
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 5 additions & 4 deletions common/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,18 +555,19 @@ bool is_tap_key(keyevent_t event)
switch (action.key.code) {
case MODS_ONESHOT:
case MODS_TAP_TOGGLE:
case KC_A ... KC_EXSEL: // tap key
case KC_LCTRL ... KC_RGUI: // tap key
default: // tap key
return true;
}
case ACT_LAYER_TAP:
case ACT_LAYER_TAP_EXT:
switch (action.layer_tap.code) {
case OP_ON_OFF:
case OP_OFF_ON:
case OP_SET_CLEAR:
case 0xc0 ... 0xdf: // with modifiers
return false;
case KC_A ... KC_EXSEL: // tap key
case KC_LCTRL ... KC_RGUI: // tap key
case OP_TAP_TOGGLE:
default: // tap key
return true;
}
return false;
Expand Down
6 changes: 2 additions & 4 deletions common/action_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 001r|mods|0000 0000 Modifiers with OneShot[TAP]
* 001r|mods|0000 0001 Modifiers with tap toggle[TAP]
* 001r|mods|0000 00xx (reserved) (0x02-03)
* 001r|mods| keycode Modifiers with tap key(0x04-A4, E0-E7)[TAP]
* (reserved) (0xA5-DF, E8-FF)
* 001r|mods| keycode Modifiers with tap key[TAP]
*
*
* Other Keys(01xx)
Expand Down Expand Up @@ -71,10 +70,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
*
* ACT_LAYER_TAP(101x):
* 101E|LLLL| keycode On/Off with tap key (0x04-A4, E0-E7)[TAP]
* 101E|LLLL| keycode On/Off with tap key [TAP]
* 101E|LLLL|110r mods On/Off with modifiers (0xC0-DF)[NOT TAP]
* r: Left/Right flag(Left:0, Right:1)
* (reserved) (0xA5-BF, E8-EF)
* 101E|LLLL|1111 0000 Invert with tap toggle (0xF0) [TAP]
* 101E|LLLL|1111 0001 On/Off (0xF1) [NOT TAP]
* 101E|LLLL|1111 0010 Off/On (0xF2) [NOT TAP]
Expand Down
3 changes: 2 additions & 1 deletion common/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)

#ifndef ACTIONMAP_ENABLE
// Use original HID usages on B0-DD instead of TMK specific codes
#ifndef USE_ORIGINAL_HID_USAGE
#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
#else
#define IS_KEY(code) ((KC_A <= (code) && (code) <= KC_EXSEL) || \
Expand Down

0 comments on commit 1b3fe95

Please sign in to comment.