1
0

core: Modifiers can be used as tap key Fix #422

This commit is contained in:
tmk 2017-01-04 12:51:13 +09:00
parent 2e464737aa
commit c98e89f2d5
3 changed files with 16 additions and 13 deletions

View File

@ -21,6 +21,7 @@ SRC += $(COMMON_DIR)/host.c \
ifeq (yes,$(strip $(UNIMAP_ENABLE))) ifeq (yes,$(strip $(UNIMAP_ENABLE)))
SRC += $(COMMON_DIR)/unimap.c SRC += $(COMMON_DIR)/unimap.c
OPT_DEFS += -DUNIMAP_ENABLE OPT_DEFS += -DUNIMAP_ENABLE
OPT_DEFS += -DACTIONMAP_ENABLE
else else
ifeq (yes,$(strip $(ACTIONMAP_ENABLE))) ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
SRC += $(COMMON_DIR)/actionmap.c SRC += $(COMMON_DIR)/actionmap.c

View File

@ -535,7 +535,9 @@ bool is_tap_key(keypos_t key)
case ACT_LAYER_TAP: case ACT_LAYER_TAP:
case ACT_LAYER_TAP_EXT: case ACT_LAYER_TAP_EXT:
switch (action.layer_tap.code) { switch (action.layer_tap.code) {
case 0x00 ... 0xdf: case KC_A ... KC_EXSEL:
case KC_KP_00 ... KC_KP_HEXADECIMAL:
case KC_LCTRL ... KC_RGUI:
case OP_TAP_TOGGLE: case OP_TAP_TOGGLE:
return true; return true;
} }

View File

@ -24,8 +24,14 @@ 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_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
#ifndef ACTIONMAP_ENABLE
#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL) #define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
#else
#define IS_KEY(code) ((KC_A <= (code) && (code) <= KC_EXSEL) || \
(KC_KP_00 <= (code) && (code) <= KC_KP_HEXADECIMAL))
#endif
#define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI) #define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI)
@ -179,7 +185,7 @@ enum hid_keyboard_keypad_usage {
KC_ROLL_OVER, KC_ROLL_OVER,
KC_POST_FAIL, KC_POST_FAIL,
KC_UNDEFINED, KC_UNDEFINED,
KC_A, KC_A, /* 0x04 */
KC_B, KC_B,
KC_C, KC_C,
KC_D, KC_D,
@ -341,10 +347,7 @@ enum hid_keyboard_keypad_usage {
KC_CRSEL, KC_CRSEL,
KC_EXSEL, /* 0xA4 */ KC_EXSEL, /* 0xA4 */
/* NOTE: 0xA5-DF are used for internal special purpose */ /* NOTE: Following code range(0xB0-DD) are shared with special codes of 8-bit keymap */
#if 0
/* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */
KC_KP_00 = 0xB0, KC_KP_00 = 0xB0,
KC_KP_000, KC_KP_000,
KC_THOUSANDS_SEPARATOR, KC_THOUSANDS_SEPARATOR,
@ -391,7 +394,6 @@ enum hid_keyboard_keypad_usage {
KC_KP_OCTAL, KC_KP_OCTAL,
KC_KP_DECIMAL, KC_KP_DECIMAL,
KC_KP_HEXADECIMAL, /* 0xDD */ KC_KP_HEXADECIMAL, /* 0xDD */
#endif
/* Modifiers */ /* Modifiers */
KC_LCTRL = 0xE0, KC_LCTRL = 0xE0,
@ -401,13 +403,11 @@ enum hid_keyboard_keypad_usage {
KC_RCTRL, KC_RCTRL,
KC_RSHIFT, KC_RSHIFT,
KC_RALT, KC_RALT,
KC_RGUI, KC_RGUI, /* 0xE7 */
/* NOTE: 0xE8-FF are used for internal special purpose */
}; };
/* Special keycodes */ /* Special keycodes for 8-bit keymap
/* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */ NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
enum internal_special_keycodes { enum internal_special_keycodes {
/* System Control */ /* System Control */
KC_SYSTEM_POWER = 0xA5, KC_SYSTEM_POWER = 0xA5,