mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-11-03 10:20:07 -05:00
OS4A refactor
This commit is contained in:
parent
0568104b4b
commit
ba9cec3eb6
7 changed files with 25 additions and 22 deletions
|
|
@ -160,8 +160,8 @@ void replace_ongoing_key(uint16_t clever_keycode, uint16_t* ongoing_keycode, key
|
|||
|
||||
void process_word(uint16_t keycodes[], uint8_t num_keycodes, keyrecord_t* record) {
|
||||
for (int i = 0; i < num_keycodes; ++i) {
|
||||
process_key(keycodes[i], record); // Better solution, if there is enought space in the chip.
|
||||
//tap_code(keycodes[i]);
|
||||
//process_key(keycodes[i], record); // Better solution, if there is enought space in the chip.
|
||||
tap_code(keycodes[i]);
|
||||
}
|
||||
bkspc_countdown = num_keycodes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ bool process_numword(uint16_t keycode, const keyrecord_t *record) {
|
|||
}
|
||||
break; */
|
||||
}
|
||||
|
||||
exit_num_word = should_exit_num_word(keycode, record);
|
||||
} else {
|
||||
if (exit_num_word) { disable_num_word(); }
|
||||
|
||||
} else if (exit_num_word) {
|
||||
disable_num_word();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ oneshot_state os_win_state = os_up_unqueued;
|
|||
|
||||
uint8_t os4a_layer = 0;
|
||||
static bool exit_os4a_layer = false;
|
||||
static bool pending_OSL = false;
|
||||
|
||||
void os4a_layer_on(uint8_t layer) {
|
||||
layer_on(layer);
|
||||
|
|
@ -61,13 +60,14 @@ bool process_os4a_keys(uint16_t keycode, keyrecord_t *record) {
|
|||
bool process_os4a_layers(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
// Should keycode exit the OS4A layer ?
|
||||
if (os4a_layer_changer(keycode)) { return true; }
|
||||
if (is_oneshot_ignored_key(keycode)) { return false; }
|
||||
|
||||
// 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
|
||||
// to be processed (ex: custom altgr, clever keys).
|
||||
uint8_t mods = get_mods() | get_oneshot_mods();
|
||||
if (!exit_os4a_layer && !pending_OSL && 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.
|
||||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
|
|
@ -101,12 +101,12 @@ bool process_mods(uint16_t keycode, keyrecord_t *record) {
|
|||
// Behaviour of the OS4A layers
|
||||
if (os4a_layer != 0) { exit_os4a_layer = process_os4a_layers(keycode, record); }
|
||||
|
||||
// Updating OSL status on OS4A layers
|
||||
pending_OSL = os4a_layer_changer(keycode);
|
||||
|
||||
// When Ctrl or Shift are released, for mouse use.
|
||||
//if (mods_for_mouse(keycode)) { mouse_mods_key_up(keycode, record); }
|
||||
|
||||
if (!record->event.pressed) {
|
||||
if (os4a_layer != 0 && exit_os4a_layer) { os4a_layer_off(os4a_layer); }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,8 +262,7 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
|
|||
case OS_FA:
|
||||
case NUMWORD:
|
||||
case TT_FA:
|
||||
//case NUM_ODK:
|
||||
//case PG_ODK:
|
||||
//case NUM_ODK: // Ne sert à rien, car NUM_ODK est un vrai one-shot : les mods sont transmis même sans paramétrage.
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
if (forbidden_chord(keycode, record, next_keycode, &next_record)) {
|
||||
// When a layer-tap key overlaps with another key on the same hand, send its base keycode.
|
||||
tap_converter(keycode, record);
|
||||
//tap_converter(keycode, record);
|
||||
record->tap.interrupted = false;
|
||||
record->tap.count = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -115,7 +118,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void post_process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||
|
||||
os4a_layer_exit_check();
|
||||
//os4a_layer_exit_check();
|
||||
//numword_exit_check();
|
||||
end_CK(record);
|
||||
}
|
||||
|
|
@ -139,10 +142,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* `----------------------------------' `----------------------------------'
|
||||
*/
|
||||
[_BASE] = LAYOUT(
|
||||
KC_NO, PG_VIRG, PG_EACU, PG_U, PG_P, PG_TIRE, PG_V, PG_M, PG_C, PG_J, PG_X, KC_NO,
|
||||
KC_NO, PG_O, PG_A, PG_I, PG_N, PG_POIN, PG_G, PG_T, PG_S, PG_R, PG_L, KC_NO,
|
||||
KC_NO, PG_Q, PG_Z, PG_Y, PG_H, CAPSLIST, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, PG_D, PG_F, PG_W, OS_ODK, KC_NO,
|
||||
KC_NO, KC_SPC, L_OS4A, LT_E, LT_MGC, LT_REPT, LT_SPC, R_OS4A, KC_RGUI, KC_NO
|
||||
KC_NO, PG_VIRG, PG_EACU, PG_U, PG_P, PG_TIRE, PG_V, PG_M, PG_C, PG_J, PG_X, KC_NO,
|
||||
KC_NO, PG_O, PG_A, PG_I, PG_N, PG_POIN, PG_G, PG_T, PG_S, PG_R, PG_L, KC_NO,
|
||||
KC_NO, PG_Q, PG_Z, PG_Y, PG_H, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, PG_D, PG_F, PG_W, OS_ODK, KC_NO,
|
||||
KC_NO, KC_SPC, L_OS4A, LT_E, LT_MGC, LT_REPT, LT_SPC, R_OS4A, KC_NO, KC_NO
|
||||
),
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ oneshot_state os_win_state = os_up_unqueued;
|
|||
|
||||
uint8_t os4a_layer = 0;
|
||||
static bool exit_os4a_layer = false;
|
||||
static bool pending_OSL = false;
|
||||
//static bool pending_OSL = false;
|
||||
|
||||
void os4a_layer_on(uint8_t layer) {
|
||||
layer_on(layer);
|
||||
|
|
@ -61,13 +61,14 @@ bool process_os4a_keys(uint16_t keycode, keyrecord_t *record) {
|
|||
bool process_os4a_layers(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
// Should keycode exit the OS4A layer ?
|
||||
if (os4a_layer_changer(keycode)) { return true; }
|
||||
if (is_oneshot_ignored_key(keycode)) { return false; }
|
||||
|
||||
// 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
|
||||
// to be processed (ex: custom altgr, clever keys).
|
||||
uint8_t mods = get_mods() | get_oneshot_mods();
|
||||
if (!exit_os4a_layer && !pending_OSL && to_be_shifted(keycode, record) && mods == 0) {
|
||||
if (!exit_os4a_layer && to_be_shifted(keycode, record) && mods == 0) {
|
||||
set_oneshot_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
return true;
|
||||
|
|
@ -101,7 +102,7 @@ bool process_mods(uint16_t keycode, keyrecord_t *record) {
|
|||
if (os4a_layer != 0) { exit_os4a_layer = process_os4a_layers(keycode, record); }
|
||||
|
||||
// Updating OSL status on OS4A layers
|
||||
pending_OSL = os4a_layer_changer(keycode);
|
||||
//pending_OSL = os4a_layer_changer(keycode);
|
||||
|
||||
// When Ctrl or Shift are released, for mouse use.
|
||||
//if (mods_for_mouse(keycode)) { mouse_mods_key_up(keycode, record); }
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
|
|||
case OS_FA:
|
||||
case NUMWORD:
|
||||
case TT_FA:
|
||||
case PG_ODK:
|
||||
//case PG_ODK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue