Remove IGNORE_MOD_TAP_INTERRUPT_PER_KEY in favour of HOLD_ON_OTHER_KEY_PRESS_PER_KEY (#15741)
This commit is contained in:
		
							parent
							
								
									ca13734f91
								
							
						
					
					
						commit
						515dd18c28
					
				
					 42 changed files with 227 additions and 518 deletions
				
			
		| 
						 | 
				
			
			@ -55,8 +55,8 @@ int retro_tapping_counter = 0;
 | 
			
		|||
#    include "process_auto_shift.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
 | 
			
		||||
__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -484,10 +484,10 @@ void process_action(keyrecord_t *record, action_t action) {
 | 
			
		|||
                default:
 | 
			
		||||
                    if (event.pressed) {
 | 
			
		||||
                        if (tap_count > 0) {
 | 
			
		||||
#    if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
 | 
			
		||||
#    if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
                            if (
 | 
			
		||||
#        ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
                                !get_ignore_mod_tap_interrupt(get_event_keycode(record->event, false), record) &&
 | 
			
		||||
#        ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
 | 
			
		||||
                                get_hold_on_other_key_press(get_event_keycode(record->event, false), record) &&
 | 
			
		||||
#        endif
 | 
			
		||||
                                record->tap.interrupted) {
 | 
			
		||||
                                dprint("mods_tap: tap: cancel: add_mods\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,14 @@
 | 
			
		|||
 | 
			
		||||
#ifndef NO_ACTION_TAPPING
 | 
			
		||||
 | 
			
		||||
#    if defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
 | 
			
		||||
#        error "IGNORE_MOD_TAP_INTERRUPT_PER_KEY has been removed; the code needs to be ported to use HOLD_ON_OTHER_KEY_PRESS_PER_KEY instead."
 | 
			
		||||
#    elif !defined(IGNORE_MOD_TAP_INTERRUPT)
 | 
			
		||||
#        if !defined(PERMISSIVE_HOLD) && !defined(PERMISSIVE_HOLD_PER_KEY) && !defined(HOLD_ON_OTHER_KEY_PRESS) && !defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
#            pragma message "The default behavior of mod-taps will change to mimic IGNORE_MOD_TAP_INTERRUPT in the future.\nIf you wish to keep the old default behavior of mod-taps, please use HOLD_ON_OTHER_KEY_PRESS."
 | 
			
		||||
#        endif
 | 
			
		||||
#    endif
 | 
			
		||||
 | 
			
		||||
#    define IS_TAPPING() !IS_NOEVENT(tapping_key.event)
 | 
			
		||||
#    define IS_TAPPING_PRESSED() (IS_TAPPING() && tapping_key.event.pressed)
 | 
			
		||||
#    define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed)
 | 
			
		||||
| 
						 | 
				
			
			@ -162,9 +170,7 @@ void action_tapping_process(keyrecord_t record) {
 | 
			
		|||
#        define TAP_GET_HOLD_ON_OTHER_KEY_PRESS false
 | 
			
		||||
#    endif
 | 
			
		||||
 | 
			
		||||
#    ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
#        define TAP_GET_IGNORE_MOD_TAP_INTERRUPT get_ignore_mod_tap_interrupt(tapping_keycode, &tapping_key)
 | 
			
		||||
#    elif defined(IGNORE_MOD_TAP_INTERRUPT)
 | 
			
		||||
#    if defined(IGNORE_MOD_TAP_INTERRUPT)
 | 
			
		||||
#        define TAP_GET_IGNORE_MOD_TAP_INTERRUPT true
 | 
			
		||||
#    else
 | 
			
		||||
#        define TAP_GET_IGNORE_MOD_TAP_INTERRUPT false
 | 
			
		||||
| 
						 | 
				
			
			@ -216,7 +222,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                            // Rolled over the two keys.
 | 
			
		||||
                            (tapping_key.tap.interrupted == true && (
 | 
			
		||||
                                (TAP_IS_LT && TAP_GET_HOLD_ON_OTHER_KEY_PRESS) ||
 | 
			
		||||
                                (TAP_IS_MT && !TAP_GET_IGNORE_MOD_TAP_INTERRUPT)
 | 
			
		||||
                                (TAP_IS_MT && TAP_GET_HOLD_ON_OTHER_KEY_PRESS)
 | 
			
		||||
                                )
 | 
			
		||||
                            )
 | 
			
		||||
                            // Makes Retro Shift ignore [IGNORE_MOD_TAP_INTERRUPT's
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -397,8 +397,17 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
                break;
 | 
			
		||||
#    endif
 | 
			
		||||
        }
 | 
			
		||||
        // If Retro Shift is disabled, possible custom actions shouldn't happen.
 | 
			
		||||
        // clang-format off
 | 
			
		||||
            // If Retro Shift is disabled, possible custom actions shouldn't happen.
 | 
			
		||||
            // clang-format off
 | 
			
		||||
#   if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
 | 
			
		||||
#       if defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
            const bool is_hold_on_interrupt = get_hold_on_other_key_press(keycode, record);
 | 
			
		||||
#       elif defined(IGNORE_MOD_TAP_INTERRUPT)
 | 
			
		||||
            const bool is_hold_on_interrupt = false;
 | 
			
		||||
#       else
 | 
			
		||||
            const bool is_hold_on_interrupt = IS_MT(keycode);
 | 
			
		||||
#       endif
 | 
			
		||||
#   endif
 | 
			
		||||
        if (IS_RETRO(keycode)
 | 
			
		||||
#    if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
 | 
			
		||||
            // Not tapped or #defines mean that rolls should use hold action.
 | 
			
		||||
| 
						 | 
				
			
			@ -407,27 +416,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
#        ifdef RETRO_TAPPING_PER_KEY
 | 
			
		||||
                || !get_retro_tapping(keycode, record)
 | 
			
		||||
#        endif
 | 
			
		||||
                || (record->tap.interrupted && (IS_LT(keycode)
 | 
			
		||||
#        if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
#            ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
 | 
			
		||||
                    ? get_hold_on_other_key_press(keycode, record)
 | 
			
		||||
#            else
 | 
			
		||||
                    ? true
 | 
			
		||||
#            endif
 | 
			
		||||
#        else
 | 
			
		||||
                    ? false
 | 
			
		||||
#        endif
 | 
			
		||||
#        if defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
 | 
			
		||||
#            ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
                    : !get_ignore_mod_tap_interrupt(keycode, record)
 | 
			
		||||
#            else
 | 
			
		||||
                    : false
 | 
			
		||||
#            endif
 | 
			
		||||
#        else
 | 
			
		||||
                    : true
 | 
			
		||||
#        endif
 | 
			
		||||
                ))
 | 
			
		||||
            )
 | 
			
		||||
                || (record->tap.interrupted && is_hold_on_interrupt))
 | 
			
		||||
#    endif
 | 
			
		||||
        ) {
 | 
			
		||||
            // clang-format on
 | 
			
		||||
| 
						 | 
				
			
			@ -454,10 +443,10 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
#    endif
 | 
			
		||||
        ) {
 | 
			
		||||
            // Fixes modifiers not being applied to rolls with AUTO_SHIFT_MODIFIERS set.
 | 
			
		||||
#    if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
 | 
			
		||||
#    if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
            if (autoshift_flags.in_progress
 | 
			
		||||
#        ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
                && !get_ignore_mod_tap_interrupt(keycode, record)
 | 
			
		||||
#        ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
 | 
			
		||||
                && get_hold_on_other_key_press(keycode, record)
 | 
			
		||||
#        endif
 | 
			
		||||
            ) {
 | 
			
		||||
                autoshift_end(KC_NO, now, false, &autoshift_lastrecord);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue