diff options
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/action.c | 2 | ||||
-rw-r--r-- | tmk_core/common/action.h | 10 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.c | 8 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.h | 2 | ||||
-rw-r--r-- | tmk_core/common/keycode.h | 2 | ||||
-rw-r--r-- | tmk_core/common/timer.h | 2 |
6 files changed, 19 insertions, 7 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 74db245c12..27c0abe6fa 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -324,7 +324,7 @@ void process_action(keyrecord_t *record, action_t action) { # if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY) if ( # ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY - !get_ignore_mod_tap_interrupt(get_event_keycode(record->event)) && + !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false)) && # endif record->tap.interrupted) { dprint("mods_tap: tap: cancel: add_mods\n"); diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index dd22023f9b..c82c9c81be 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h @@ -28,6 +28,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern "C" { #endif +/* Disable macro and function features when LTO is enabled, since they break */ +#ifdef LINK_TIME_OPTIMIZATION_ENABLE +# ifndef NO_ACTION_MACRO +# define NO_ACTION_MACRO +# endif +# ifndef NO_ACTION_FUNCTION +# define NO_ACTION_FUNCTION +# endif +#endif + /* tapping count and state */ typedef struct { bool interrupted : 1; diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index acce3ee515..34f08d8904 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -22,7 +22,7 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPING_TERM; } # ifdef TAPPING_TERM_PER_KEY -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event))) +# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false))) # else # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM) # endif @@ -122,10 +122,10 @@ bool process_tapping(keyrecord_t *keyp) { # if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) else if ( # ifdef TAPPING_TERM_PER_KEY - (get_tapping_term(get_event_keycode(tapping_key.event)) >= 500) && + (get_tapping_term(get_event_keycode(tapping_key.event, false)) >= 500) && # endif # ifdef PERMISSIVE_HOLD_PER_KEY - !get_permissive_hold(get_event_keycode(tapping_key.event), keyp) && + !get_permissive_hold(get_event_keycode(tapping_key.event, false), keyp) && # endif IS_RELEASED(event) && waiting_buffer_typed(event)) { debug("Tapping: End. No tap. Interfered by typing key\n"); @@ -246,7 +246,7 @@ bool process_tapping(keyrecord_t *keyp) { # if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY) if ( # ifdef TAPPING_FORCE_HOLD_PER_KEY - !get_tapping_force_hold(get_event_keycode(tapping_key.event), keyp) && + !get_tapping_force_hold(get_event_keycode(tapping_key.event, false), keyp) && # endif !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { // sequential tap. diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h index 509d5eabd8..5eaef1c5f0 100644 --- a/tmk_core/common/action_tapping.h +++ b/tmk_core/common/action_tapping.h @@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define WAITING_BUFFER_SIZE 8 #ifndef NO_ACTION_TAPPING -uint16_t get_event_keycode(keyevent_t event); +uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); uint16_t get_tapping_term(uint16_t keycode); void action_tapping_process(keyrecord_t record); #endif diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index e1059fadf0..5c8ba8fe60 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -152,11 +152,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Modifiers */ #define KC_LCTL KC_LCTRL #define KC_LSFT KC_LSHIFT +#define KC_LOPT KC_LALT #define KC_LCMD KC_LGUI #define KC_LWIN KC_LGUI #define KC_RCTL KC_RCTRL #define KC_RSFT KC_RSHIFT #define KC_ALGR KC_RALT +#define KC_ROPT KC_RALT #define KC_RCMD KC_RGUI #define KC_RWIN KC_RGUI diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h index bbaae109d0..52bc1cc671 100644 --- a/tmk_core/common/timer.h +++ b/tmk_core/common/timer.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # include "avr/timer_avr.h" #endif -#define TIMER_DIFF(a, b, max) ((a) >= (b) ? (a) - (b) : (max) - (b) + (a)) +#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a))))) #define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) #define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) #define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX) |