Browse Source

lol dumb solution that doesn't break

master
Stefan Dorn 4 years ago
parent
commit
f9cd0f21d9
2 changed files with 67 additions and 44 deletions
  1. +63
    -43
      src/main.c
  2. +4
    -1
      src/main.h

+ 63
- 43
src/main.c View File

@ -490,16 +490,9 @@ void kbfun_modifier_sticky(keycode key, bool is_pressed) {
// combo keyfuncs
// ----------------------------------------------------------------------------
void _kbfun_combo_normal_press_release(keycode key, bool is_pressed, int combo_keys, ...) {
va_list combo_key_args;
va_start(combo_key_args, combo_keys);
for (int i=0; i < combo_keys; i++) {
keycode combo_key = (keycode) va_arg(combo_key_args, int);
_kbfun_modifier_press_release(combo_key, is_pressed);
}
va_end(combo_key_args);
void _kbfun_combo_normal_press_release(keycode combo_key, keycode key, bool is_pressed) {
_kbfun_modifier_press_release(combo_key, is_pressed);
kbfun_normal_press_release(key, is_pressed);
}
@ -531,44 +524,71 @@ void _kbfun_combo_layer_press_release(keycode combo_key, keycode key, bool is_pr
_kbfun_modifier_press_release(combo_key, is_pressed);
}
void kbfun_shift_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift); } // +shift
void kbfun_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl); } // +control
void kbfun_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftAlt); } // +alt
void kbfun_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftGUI); } // +win
void kbfun_shift_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftShift, key, is_pressed); } // +shift
void kbfun_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftControl, key, is_pressed); } // +control
void kbfun_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftAlt, key, is_pressed); } // +alt
void kbfun_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftGUI, key, is_pressed); } // +win
//
void kbfun_shift_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftShift, key, is_pressed); } // +shift once
void kbfun_control_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftControl, key, is_pressed); } // +control once
void kbfun_alt_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftAlt, key, is_pressed); } // +alt once
void kbfun_win_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftGUI, key, is_pressed); } // +win once
//
void kbfun_shift_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftShift, key, is_pressed); } // +shift + layer
void kbfun_control_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftControl, key, is_pressed); } // +control + layer
void kbfun_alt_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftAlt, key, is_pressed); } // +alt + layer
void kbfun_win_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftGUI, key, is_pressed); } // +win + layer
void kbfun_shift_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(key, is_pressed, MOD_KEY_LeftShift); } // +shift once
void kbfun_control_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(key, is_pressed, MOD_KEY_LeftControl); } // +control once
void kbfun_alt_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(key, is_pressed, MOD_KEY_LeftAlt); } // +alt once
void kbfun_win_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(key, is_pressed, MOD_KEY_LeftGUI); } // +win once
// multi-combos
void kbfun_shift_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(key, is_pressed, MOD_KEY_LeftShift); } // +shift + layer
void kbfun_control_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(key, is_pressed, MOD_KEY_LeftControl); } // +control + layer
void kbfun_alt_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(key, is_pressed, MOD_KEY_LeftAlt); } // +alt + layer
void kbfun_win_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(key, is_pressed, MOD_KEY_LeftGUI); } // +win + layer
// TODO lol
// multi-combos
void _kbfun_combo_normal_press_release2(keycode combo_key1, keycode combo_key2, keycode key, bool is_pressed) {
_kbfun_modifier_press_release(combo_key1, is_pressed);
_kbfun_modifier_press_release(combo_key2, is_pressed);
kbfun_normal_press_release(key, is_pressed);
}
void _kbfun_combo_normal_press_release3(keycode combo_key1, keycode combo_key2, keycode combo_key3, keycode key, bool is_pressed) {
_kbfun_modifier_press_release(combo_key1, is_pressed);
_kbfun_modifier_press_release(combo_key2, is_pressed);
_kbfun_modifier_press_release(combo_key3, is_pressed);
kbfun_normal_press_release(key, is_pressed);
}
void _kbfun_combo_normal_press_release4(keycode combo_key1, keycode combo_key2, keycode combo_key3, keycode combo_key4, keycode key, bool is_pressed) {
_kbfun_modifier_press_release(combo_key1, is_pressed);
_kbfun_modifier_press_release(combo_key2, is_pressed);
_kbfun_modifier_press_release(combo_key3, is_pressed);
_kbfun_modifier_press_release(combo_key4, is_pressed);
kbfun_normal_press_release(key, is_pressed);
}
void kbfun_shift_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftControl); }
void kbfun_shift_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftAlt); }
void kbfun_shift_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftGUI); }
void kbfun_control_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftAlt); }
void kbfun_control_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftGUI); }
void kbfun_alt_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_shift_control_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftAlt); }
void kbfun_shift_control_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftGUI); }
void kbfun_shift_alt_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftAlt, MOD_KEY_LeftControl); }
void kbfun_shift_alt_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_shift_win_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftGUI, MOD_KEY_LeftControl); }
void kbfun_shift_win_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftGUI, MOD_KEY_LeftAlt); }
void kbfun_control_alt_shift_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftShift); }
void kbfun_control_alt_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_control_win_shift_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftGUI, MOD_KEY_LeftShift); }
void kbfun_control_win_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftControl, MOD_KEY_LeftGUI, MOD_KEY_LeftAlt); }
void kbfun_alt_win_shift_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI, MOD_KEY_LeftShift); }
void kbfun_alt_win_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI, MOD_KEY_LeftControl); }
void kbfun_shift_control_alt_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(key, is_pressed, MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
#define COMBO2(x1, x2) _kbfun_combo_normal_press_release2(x1, x2, key, is_pressed)
#define COMBO3(x1, x2, x3) _kbfun_combo_normal_press_release3(x1, x2, x3, key, is_pressed)
#define COMBO4(x1, x2, x3, x4) _kbfun_combo_normal_press_release4(x1, x2, x3, x4, key, is_pressed)
void kbfun_shift_control_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftShift, MOD_KEY_LeftControl); }
void kbfun_shift_alt_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftShift, MOD_KEY_LeftAlt); }
void kbfun_shift_win_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftShift, MOD_KEY_LeftGUI); }
void kbfun_control_alt_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftControl, MOD_KEY_LeftAlt); }
void kbfun_control_win_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftControl, MOD_KEY_LeftGUI); }
void kbfun_alt_win_press_release(keycode key, bool is_pressed) { COMBO2(MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_shift_control_alt_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftAlt); }
void kbfun_shift_control_win_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftGUI); }
void kbfun_shift_alt_control_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftAlt, MOD_KEY_LeftControl); }
void kbfun_shift_alt_win_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_shift_win_control_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftGUI, MOD_KEY_LeftControl); }
void kbfun_shift_win_alt_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftShift, MOD_KEY_LeftGUI, MOD_KEY_LeftAlt); }
void kbfun_control_alt_shift_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftShift); }
void kbfun_control_alt_win_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
void kbfun_control_win_shift_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftControl, MOD_KEY_LeftGUI, MOD_KEY_LeftShift); }
void kbfun_control_win_alt_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftControl, MOD_KEY_LeftGUI, MOD_KEY_LeftAlt); }
void kbfun_alt_win_shift_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftAlt, MOD_KEY_LeftGUI, MOD_KEY_LeftShift); }
void kbfun_alt_win_control_press_release(keycode key, bool is_pressed) { COMBO3(MOD_KEY_LeftAlt, MOD_KEY_LeftGUI, MOD_KEY_LeftControl); }
void kbfun_shift_control_alt_win_press_release(keycode key, bool is_pressed) { COMBO4(MOD_KEY_LeftShift, MOD_KEY_LeftControl, MOD_KEY_LeftAlt, MOD_KEY_LeftGUI); }
// capslock
void kbfun_capslock_press_release(keycode key, bool is_pressed) {


+ 4
- 1
src/main.h View File

@ -19,6 +19,9 @@ void kbfun_control_alt_press_release(keycode key,bool is_pressed);
void kbfun_shift_win_press_release(keycode key,bool is_pressed);
void kbfun_shift_alt_press_release(keycode key,bool is_pressed);
void kbfun_shift_control_press_release(keycode key,bool is_pressed);
void _kbfun_combo_normal_press_release4(keycode combo_key1,keycode combo_key2,keycode combo_key3,keycode combo_key4,keycode key,bool is_pressed);
void _kbfun_combo_normal_press_release3(keycode combo_key1,keycode combo_key2,keycode combo_key3,keycode key,bool is_pressed);
void _kbfun_combo_normal_press_release2(keycode combo_key1,keycode combo_key2,keycode key,bool is_pressed);
void kbfun_win_press_release_once(keycode key,bool is_pressed);
void kbfun_alt_press_release_once(keycode key,bool is_pressed);
void kbfun_control_press_release_once(keycode key,bool is_pressed);
@ -29,7 +32,7 @@ void kbfun_control_press_release(keycode key,bool is_pressed);
void kbfun_shift_press_release(keycode key,bool is_pressed);
void _kbfun_combo_layer_press_release(keycode combo_key,keycode key,bool is_pressed);
void _kbfun_combo_normal_press_release_once(keycode combo_key,keycode key,bool is_pressed);
void _kbfun_combo_normal_press_release(keycode key,bool is_pressed,int combo_keys,...);
void _kbfun_combo_normal_press_release(keycode combo_key,keycode key,bool is_pressed);
void kbfun_modifier_sticky(keycode key,bool is_pressed);
void kbfun_modifier_press_release(keycode key,bool is_pressed);
void kbfun_mediakey_press_release(keycode key,bool is_pressed);


Loading…
Cancel
Save