mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-11-03 10:20:07 -05:00
Changements nom fonctions OS4A
This commit is contained in:
parent
5795c021cf
commit
43f85ffdda
5 changed files with 19 additions and 20 deletions
|
|
@ -45,7 +45,6 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
|
|||
case OU_GRV:
|
||||
case KC_SPC: // When space is added by Clever Keys
|
||||
case CNL_ODK:
|
||||
case PG_ODK:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -57,10 +57,12 @@ bool process_os4a_keys(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool process_os4a_layers(uint16_t keycode, keyrecord_t *record) {
|
||||
bool os4a_layer_process_outcome(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
// Should keycode exit the OS4A layer ?
|
||||
if (os4a_layer_changer(keycode)) { return true; }
|
||||
// Should keycode exit the OS4A layer without further process ?
|
||||
if (should_exit_os4a_layer(keycode)) { return true; }
|
||||
|
||||
// Should keycode stay on the OS4A layer, e.g. Callum mod ?
|
||||
if (is_oneshot_ignored_key(keycode)) { return false; }
|
||||
|
||||
// Add OS Shift when no other mods are active.
|
||||
|
|
@ -81,7 +83,7 @@ void mouse_mods_key_up(uint16_t keycode, keyrecord_t *record) {
|
|||
//if (get_mods() & QK_ONE_SHOT_MOD_GET_MODS(keycode)) {
|
||||
|
||||
// When ctrl or shift are released after being held, exit the OS4A layer.
|
||||
if (!record->event.pressed && !record->tap.count) {
|
||||
if (!record->tap.count) {
|
||||
os4a_layer_off(os4a_layer);
|
||||
}
|
||||
}
|
||||
|
|
@ -99,13 +101,15 @@ bool process_mods(uint16_t keycode, keyrecord_t *record) {
|
|||
if (IS_OS4A_KEY(keycode)) { return process_os4a_keys(keycode, record); }
|
||||
|
||||
// Behaviour of the OS4A layers
|
||||
if (record->event.pressed) {
|
||||
if (os4a_layer != 0) { exit_os4a_layer = process_os4a_layers(keycode, record); }
|
||||
|
||||
} else {
|
||||
// When Ctrl or Shift are released, for mouse use.
|
||||
//if (mods_for_mouse(keycode)) { mouse_mods_key_up(keycode, record); }
|
||||
if (os4a_layer != 0 && exit_os4a_layer) { os4a_layer_off(os4a_layer); }
|
||||
if (os4a_layer != 0) {
|
||||
|
||||
if (record->event.pressed) {
|
||||
exit_os4a_layer = os4a_layer_process_outcome(keycode, record);
|
||||
} else {
|
||||
// When Ctrl or Shift are released, for mouse use.
|
||||
//if (mods_for_mouse(keycode)) { mouse_mods_key_up(keycode, record); }
|
||||
if (exit_os4a_layer) { os4a_layer_off(os4a_layer); }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
extern uint8_t os4a_layer;
|
||||
//extern bool exit_os4a_layer;
|
||||
//extern bool pending_OSL;
|
||||
|
||||
void os4a_layer_off(uint8_t layer);
|
||||
void os4a_layer_on(uint8_t layer);
|
||||
|
|
@ -37,7 +35,7 @@ bool process_os4a_keys(uint16_t keycode, keyrecord_t *record);
|
|||
|
||||
void update_osl(uint16_t keycode);
|
||||
|
||||
bool process_os4a_layers(uint16_t keycode, keyrecord_t *record);
|
||||
bool os4a_layer_process_outcome(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
void mouse_mods_key_up(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ uint8_t get_os4a_layer(uint16_t keycode) {
|
|||
}
|
||||
}
|
||||
|
||||
bool os4a_layer_changer(uint16_t keycode) {
|
||||
bool should_exit_os4a_layer(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case OS_FA:
|
||||
case NUMWORD:
|
||||
|
|
@ -247,7 +247,6 @@ bool is_oneshot_cancel_key(uint16_t keycode) {
|
|||
bool is_oneshot_ignored_key(uint16_t keycode) {
|
||||
|
||||
const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
|
||||
//if (keycode == OS_ODK && (mods & ~(MOD_MASK_SHIFT | MOD_BIT(KC_ALGR)))) { return true; }
|
||||
//if (keycode == OS_ODK && (mods & ~MOD_BIT(KC_ALGR))) { return true; }
|
||||
|
||||
switch (keycode) {
|
||||
|
|
@ -266,12 +265,11 @@ bool is_oneshot_ignored_key(uint16_t keycode) {
|
|||
case OS_RALT:
|
||||
case OS_LALT:
|
||||
case OS_WIN:
|
||||
// OS_FA must be on the list, to be combined with Alt
|
||||
case OS_FA:
|
||||
case NUMWORD:
|
||||
case TG_FA:
|
||||
return true;
|
||||
/* default:
|
||||
return false; */
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ bool process_custom_tap_hold(uint16_t keycode, keyrecord_t *record);
|
|||
uint16_t get_ongoing_keycode_user(uint16_t keycode);
|
||||
|
||||
uint8_t get_os4a_layer(uint16_t keycode);
|
||||
bool os4a_layer_changer(uint16_t keycode);
|
||||
bool should_exit_os4a_layer(uint16_t keycode);
|
||||
bool to_be_shifted(uint16_t keycode, keyrecord_t *record);
|
||||
//bool mods_for_mouse(uint16_t keycode);
|
||||
Loading…
Add table
Add a link
Reference in a new issue