mirror of
				https://github.com/qmk/qmk_userspace.git
				synced 2025-11-04 02:40:06 -05:00 
			
		
		
		
	essai fonction
This commit is contained in:
		
					parent
					
						
							
								98abb13bd0
							
						
					
				
			
			
				commit
				
					
						11022b0023
					
				
			
		
					 3 changed files with 33 additions and 8 deletions
				
			
		| 
						 | 
					@ -21,7 +21,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
    if (record->event.pressed) {    // On press
 | 
					    if (record->event.pressed) {    // On press
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
 | 
					        const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
 | 
				
			||||||
        bool mod_odk = false;
 | 
					        //bool mod_odk = false;
 | 
				
			||||||
        //const uint8_t mods = get_mods() | get_oneshot_mods();
 | 
					        //const uint8_t mods = get_mods() | get_oneshot_mods();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (keycode == OS_ODK) {
 | 
					        if (keycode == OS_ODK) {
 | 
				
			||||||
| 
						 | 
					@ -32,12 +32,12 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else if (keycode == MOD_ODK) {
 | 
					        } else if (keycode == PG_ODK) {
 | 
				
			||||||
            mod_odk = true;
 | 
					            //mod_odk = true;
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else if (IS_LAYER_ON(_ODK)) {
 | 
					        } else if (IS_LAYER_ON(_ODK)) {
 | 
				
			||||||
            switch (keycode) {
 | 
					            switch (keycode) {
 | 
				
			||||||
                //case PG_3PTS:   // For Clever Keys
 | 
					 | 
				
			||||||
                case PG_PVIR:
 | 
					                case PG_PVIR:
 | 
				
			||||||
                case PG_AROB:
 | 
					                case PG_AROB:
 | 
				
			||||||
                case PG_K:
 | 
					                case PG_K:
 | 
				
			||||||
| 
						 | 
					@ -46,10 +46,12 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
                case OU_GRV:
 | 
					                case OU_GRV:
 | 
				
			||||||
                case KC_SPC:    // When space is added by Clever Keys
 | 
					                case KC_SPC:    // When space is added by Clever Keys
 | 
				
			||||||
                case CNL_ODK:
 | 
					                case CNL_ODK:
 | 
				
			||||||
 | 
					                case PG_ODK:
 | 
				
			||||||
                    return true;
 | 
					                    return true;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
                    mod_odk = true;
 | 
					                    mod_odk();
 | 
				
			||||||
 | 
					                    //mod_odk = true;
 | 
				
			||||||
                    //process_odk_layer(MOD_ODK, record);
 | 
					                    //process_odk_layer(MOD_ODK, record);
 | 
				
			||||||
                    // Don't use tap_code, it doesn't go through process_record.
 | 
					                    // Don't use tap_code, it doesn't go through process_record.
 | 
				
			||||||
                    // therefore it doesn't trigger the special behaviour of PG_ODK described above
 | 
					                    // therefore it doesn't trigger the special behaviour of PG_ODK described above
 | 
				
			||||||
| 
						 | 
					@ -57,7 +59,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (mod_odk) {
 | 
					/*         if (mod_odk) {
 | 
				
			||||||
            // Special behaviour of PG_ODK when shifted
 | 
					            // Special behaviour of PG_ODK when shifted
 | 
				
			||||||
            // Shift must apply to the next keycode
 | 
					            // Shift must apply to the next keycode
 | 
				
			||||||
            mod_odk = false;
 | 
					            mod_odk = false;
 | 
				
			||||||
| 
						 | 
					@ -74,9 +76,31 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (is_shifted) {
 | 
					            if (is_shifted) {
 | 
				
			||||||
                set_oneshot_mods(MOD_BIT(KC_LSFT));     // Don't use weak mods !
 | 
					                set_oneshot_mods(MOD_BIT(KC_LSFT));     // Don't use weak mods !
 | 
				
			||||||
 | 
					                is_shifted = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (keycode == MOD_ODK) { return false; }
 | 
					            if (keycode == MOD_ODK) { return false; }
 | 
				
			||||||
        }
 | 
					        } */
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void mod_odk(void) {
 | 
				
			||||||
 | 
					    // Special behaviour of PG_ODK when shifted
 | 
				
			||||||
 | 
					    // Shift must apply to the next keycode
 | 
				
			||||||
 | 
					    bool is_shifted = false;
 | 
				
			||||||
 | 
					    const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (mods & MOD_MASK_SHIFT) {
 | 
				
			||||||
 | 
					        del_weak_mods(MOD_MASK_SHIFT);
 | 
				
			||||||
 | 
					        del_oneshot_mods(MOD_MASK_SHIFT);
 | 
				
			||||||
 | 
					        unregister_mods(MOD_MASK_SHIFT);
 | 
				
			||||||
 | 
					        is_shifted = true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    tap_code(PG_ODK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (is_shifted) {
 | 
				
			||||||
 | 
					        set_oneshot_mods(MOD_BIT(KC_LSFT));     // Don't use weak mods !
 | 
				
			||||||
 | 
					        is_shifted = false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool process_odk_layer(uint16_t keycode, keyrecord_t *record);
 | 
					bool process_odk_layer(uint16_t keycode, keyrecord_t *record);
 | 
				
			||||||
 | 
					void mod_odk(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@ bool process_os4a_layers(uint16_t keycode, keyrecord_t *record) {
 | 
				
			||||||
    // Add OS Shift when no other mods are active.
 | 
					    // Add OS Shift when no other mods are active.
 | 
				
			||||||
    // Testing exit_os4a_layer is necessary to prevent OS shift to be added when other features create keyrecords
 | 
					    // Testing exit_os4a_layer is necessary to prevent OS shift to be added when other features create keyrecords
 | 
				
			||||||
    // to be processed (ex: custom altgr, clever keys).
 | 
					    // to be processed (ex: custom altgr, clever keys).
 | 
				
			||||||
    uint8_t mods = get_mods() | get_oneshot_mods();
 | 
					    const uint8_t mods = get_mods() | get_oneshot_mods();
 | 
				
			||||||
    if (!exit_os4a_layer && to_be_shifted(keycode, record) && mods == 0) {
 | 
					    if (!exit_os4a_layer && to_be_shifted(keycode, record) && mods == 0) {
 | 
				
			||||||
      // Don't use weak mods, it interferes with Capsword.
 | 
					      // Don't use weak mods, it interferes with Capsword.
 | 
				
			||||||
      set_oneshot_mods(MOD_BIT(KC_LSFT));
 | 
					      set_oneshot_mods(MOD_BIT(KC_LSFT));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue