process_combo.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /* Copyright 2016 Jack Humbert
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "print.h"
  17. #include "process_combo.h"
  18. #include "action_tapping.h"
  19. #ifdef COMBO_COUNT
  20. __attribute__((weak)) combo_t key_combos[COMBO_COUNT];
  21. uint16_t COMBO_LEN = COMBO_COUNT;
  22. #else
  23. extern combo_t key_combos[];
  24. extern uint16_t COMBO_LEN;
  25. #endif
  26. __attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
  27. #ifdef COMBO_MUST_HOLD_PER_COMBO
  28. __attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) { return false; }
  29. #endif
  30. #ifdef COMBO_MUST_TAP_PER_COMBO
  31. __attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) { return false; }
  32. #endif
  33. #ifdef COMBO_TERM_PER_COMBO
  34. __attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) { return COMBO_TERM; }
  35. #endif
  36. #ifdef COMBO_MUST_PRESS_IN_ORDER_PER_COMBO
  37. __attribute__((weak)) bool get_combo_must_press_in_order(uint16_t combo_index, combo_t *combo) { return true; }
  38. #endif
  39. #ifdef COMBO_PROCESS_KEY_RELEASE
  40. __attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) { return false; }
  41. #endif
  42. #ifdef COMBO_SHOULD_TRIGGER
  43. __attribute__((weak)) bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) { return true; }
  44. #endif
  45. #ifndef COMBO_NO_TIMER
  46. static uint16_t timer = 0;
  47. #endif
  48. static bool b_combo_enable = true; // defaults to enabled
  49. static uint16_t longest_term = 0;
  50. typedef struct {
  51. keyrecord_t record;
  52. uint16_t combo_index;
  53. uint16_t keycode;
  54. } queued_record_t;
  55. static uint8_t key_buffer_size = 0;
  56. static queued_record_t key_buffer[COMBO_KEY_BUFFER_LENGTH];
  57. typedef struct {
  58. uint16_t combo_index;
  59. } queued_combo_t;
  60. static uint8_t combo_buffer_write = 0;
  61. static uint8_t combo_buffer_read = 0;
  62. static queued_combo_t combo_buffer[COMBO_BUFFER_LENGTH];
  63. #define INCREMENT_MOD(i) i = (i + 1) % COMBO_BUFFER_LENGTH
  64. #define COMBO_KEY_POS ((keypos_t){.col = 254, .row = 254})
  65. #ifndef EXTRA_SHORT_COMBOS
  66. /* flags are their own elements in combo_t struct. */
  67. # define COMBO_ACTIVE(combo) (combo->active)
  68. # define COMBO_DISABLED(combo) (combo->disabled)
  69. # define COMBO_STATE(combo) (combo->state)
  70. # define ACTIVATE_COMBO(combo) \
  71. do { \
  72. combo->active = true; \
  73. } while (0)
  74. # define DEACTIVATE_COMBO(combo) \
  75. do { \
  76. combo->active = false; \
  77. } while (0)
  78. # define DISABLE_COMBO(combo) \
  79. do { \
  80. combo->disabled = true; \
  81. } while (0)
  82. # define RESET_COMBO_STATE(combo) \
  83. do { \
  84. combo->disabled = false; \
  85. combo->state = 0; \
  86. } while (0)
  87. #else
  88. /* flags are at the two high bits of state. */
  89. # define COMBO_ACTIVE(combo) (combo->state & 0x80)
  90. # define COMBO_DISABLED(combo) (combo->state & 0x40)
  91. # define COMBO_STATE(combo) (combo->state & 0x3F)
  92. # define ACTIVATE_COMBO(combo) \
  93. do { \
  94. combo->state |= 0x80; \
  95. } while (0)
  96. # define DEACTIVATE_COMBO(combo) \
  97. do { \
  98. combo->state &= ~0x80; \
  99. } while (0)
  100. # define DISABLE_COMBO(combo) \
  101. do { \
  102. combo->state |= 0x40; \
  103. } while (0)
  104. # define RESET_COMBO_STATE(combo) \
  105. do { \
  106. combo->state &= ~0x7F; \
  107. } while (0)
  108. #endif
  109. static inline void release_combo(uint16_t combo_index, combo_t *combo) {
  110. if (combo->keycode) {
  111. keyrecord_t record = {
  112. .event =
  113. {
  114. .key = COMBO_KEY_POS,
  115. .time = timer_read() | 1,
  116. .pressed = false,
  117. },
  118. .keycode = combo->keycode,
  119. };
  120. #ifndef NO_ACTION_TAPPING
  121. action_tapping_process(record);
  122. #else
  123. process_record(&record);
  124. #endif
  125. } else {
  126. process_combo_event(combo_index, false);
  127. }
  128. DEACTIVATE_COMBO(combo);
  129. }
  130. static inline bool _get_combo_must_hold(uint16_t combo_index, combo_t *combo) {
  131. #ifdef COMBO_NO_TIMER
  132. return false;
  133. #elif defined(COMBO_MUST_HOLD_PER_COMBO)
  134. return get_combo_must_hold(combo_index, combo);
  135. #elif defined(COMBO_MUST_HOLD_MODS)
  136. return (KEYCODE_IS_MOD(combo->keycode) || (combo->keycode >= QK_MOMENTARY && combo->keycode <= QK_MOMENTARY_MAX));
  137. #endif
  138. return false;
  139. }
  140. static inline uint16_t _get_wait_time(uint16_t combo_index, combo_t *combo) {
  141. if (_get_combo_must_hold(combo_index, combo)
  142. #ifdef COMBO_MUST_TAP_PER_COMBO
  143. || get_combo_must_tap(combo_index, combo)
  144. #endif
  145. ) {
  146. if (longest_term < COMBO_HOLD_TERM) {
  147. return COMBO_HOLD_TERM;
  148. }
  149. }
  150. return longest_term;
  151. }
  152. static inline uint16_t _get_combo_term(uint16_t combo_index, combo_t *combo) {
  153. #if defined(COMBO_TERM_PER_COMBO)
  154. return get_combo_term(combo_index, combo);
  155. #endif
  156. return COMBO_TERM;
  157. }
  158. void clear_combos(void) {
  159. uint16_t index = 0;
  160. longest_term = 0;
  161. for (index = 0; index < COMBO_LEN; ++index) {
  162. combo_t *combo = &key_combos[index];
  163. if (!COMBO_ACTIVE(combo)) {
  164. RESET_COMBO_STATE(combo);
  165. }
  166. }
  167. }
  168. static inline void dump_key_buffer(void) {
  169. /* First call start from 0 index; recursive calls need to start from i+1 index */
  170. static uint8_t key_buffer_next = 0;
  171. if (key_buffer_size == 0) {
  172. return;
  173. }
  174. for (uint8_t key_buffer_i = key_buffer_next; key_buffer_i < key_buffer_size; key_buffer_i++) {
  175. key_buffer_next = key_buffer_i + 1;
  176. queued_record_t *qrecord = &key_buffer[key_buffer_i];
  177. keyrecord_t * record = &qrecord->record;
  178. if (IS_NOEVENT(record->event)) {
  179. continue;
  180. }
  181. if (!record->keycode && qrecord->combo_index != (uint16_t)-1) {
  182. process_combo_event(qrecord->combo_index, true);
  183. } else {
  184. #ifndef NO_ACTION_TAPPING
  185. action_tapping_process(*record);
  186. #else
  187. process_record(record);
  188. #endif
  189. }
  190. record->event.time = 0;
  191. }
  192. key_buffer_next = key_buffer_size = 0;
  193. }
  194. #define NO_COMBO_KEYS_ARE_DOWN (0 == COMBO_STATE(combo))
  195. #define ALL_COMBO_KEYS_ARE_DOWN(state, key_count) (((1 << key_count) - 1) == state)
  196. #define ONLY_ONE_KEY_IS_DOWN(state) !(state & (state - 1))
  197. #define KEY_NOT_YET_RELEASED(state, key_index) ((1 << key_index) & state)
  198. #define KEY_STATE_DOWN(state, key_index) \
  199. do { \
  200. state |= (1 << key_index); \
  201. } while (0)
  202. #define KEY_STATE_UP(state, key_index) \
  203. do { \
  204. state &= ~(1 << key_index); \
  205. } while (0)
  206. static inline void _find_key_index_and_count(const uint16_t *keys, uint16_t keycode, uint16_t *key_index, uint8_t *key_count) {
  207. while (true) {
  208. uint16_t key = pgm_read_word(&keys[*key_count]);
  209. if (keycode == key) *key_index = *key_count;
  210. if (COMBO_END == key) break;
  211. (*key_count)++;
  212. }
  213. }
  214. void drop_combo_from_buffer(uint16_t combo_index) {
  215. /* Mark a combo as processed from the buffer. If the buffer is in the
  216. * beginning of the buffer, drop it. */
  217. uint8_t i = combo_buffer_read;
  218. while (i != combo_buffer_write) {
  219. queued_combo_t *qcombo = &combo_buffer[i];
  220. if (qcombo->combo_index == combo_index) {
  221. combo_t *combo = &key_combos[combo_index];
  222. DISABLE_COMBO(combo);
  223. if (i == combo_buffer_read) {
  224. INCREMENT_MOD(combo_buffer_read);
  225. }
  226. break;
  227. }
  228. INCREMENT_MOD(i);
  229. }
  230. }
  231. void apply_combo(uint16_t combo_index, combo_t *combo) {
  232. /* Apply combo's result keycode to the last chord key of the combo and
  233. * disable the other keys. */
  234. if (COMBO_DISABLED(combo)) {
  235. return;
  236. }
  237. // state to check against so we find the last key of the combo from the buffer
  238. #if defined(EXTRA_EXTRA_LONG_COMBOS)
  239. uint32_t state = 0;
  240. #elif defined(EXTRA_LONG_COMBOS)
  241. uint16_t state = 0;
  242. #else
  243. uint8_t state = 0;
  244. #endif
  245. for (uint8_t key_buffer_i = 0; key_buffer_i < key_buffer_size; key_buffer_i++) {
  246. queued_record_t *qrecord = &key_buffer[key_buffer_i];
  247. keyrecord_t * record = &qrecord->record;
  248. uint16_t keycode = qrecord->keycode;
  249. uint8_t key_count = 0;
  250. uint16_t key_index = -1;
  251. _find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
  252. if (-1 == (int16_t)key_index) {
  253. // key not part of this combo
  254. continue;
  255. }
  256. KEY_STATE_DOWN(state, key_index);
  257. if (ALL_COMBO_KEYS_ARE_DOWN(state, key_count)) {
  258. // this in the end executes the combo when the key_buffer is dumped.
  259. record->keycode = combo->keycode;
  260. record->event.key = COMBO_KEY_POS;
  261. qrecord->combo_index = combo_index;
  262. ACTIVATE_COMBO(combo);
  263. break;
  264. } else {
  265. // key was part of the combo but not the last one, "disable" it
  266. // by making it a TICK event.
  267. record->event.time = 0;
  268. }
  269. }
  270. drop_combo_from_buffer(combo_index);
  271. }
  272. static inline void apply_combos(void) {
  273. // Apply all buffered normal combos.
  274. for (uint8_t i = combo_buffer_read; i != combo_buffer_write; INCREMENT_MOD(i)) {
  275. queued_combo_t *buffered_combo = &combo_buffer[i];
  276. combo_t * combo = &key_combos[buffered_combo->combo_index];
  277. #ifdef COMBO_MUST_TAP_PER_COMBO
  278. if (get_combo_must_tap(buffered_combo->combo_index, combo)) {
  279. // Tap-only combos are applied on key release only, so let's drop 'em here.
  280. drop_combo_from_buffer(buffered_combo->combo_index);
  281. continue;
  282. }
  283. #endif
  284. apply_combo(buffered_combo->combo_index, combo);
  285. }
  286. dump_key_buffer();
  287. clear_combos();
  288. }
  289. combo_t *overlaps(combo_t *combo1, combo_t *combo2) {
  290. /* Checks if the combos overlap and returns the combo that should be
  291. * dropped from the combo buffer.
  292. * The combo that has less keys will be dropped. If they have the same
  293. * amount of keys, drop combo1. */
  294. uint8_t idx1 = 0, idx2 = 0;
  295. uint16_t key1, key2;
  296. bool overlaps = false;
  297. while ((key1 = pgm_read_word(&combo1->keys[idx1])) != COMBO_END) {
  298. idx2 = 0;
  299. while ((key2 = pgm_read_word(&combo2->keys[idx2])) != COMBO_END) {
  300. if (key1 == key2) overlaps = true;
  301. idx2 += 1;
  302. }
  303. idx1 += 1;
  304. }
  305. if (!overlaps) return NULL;
  306. if (idx2 < idx1) return combo2;
  307. return combo1;
  308. }
  309. #if defined(COMBO_MUST_PRESS_IN_ORDER) || defined(COMBO_MUST_PRESS_IN_ORDER_PER_COMBO)
  310. static bool keys_pressed_in_order(uint16_t combo_index, combo_t *combo, uint16_t key_index, uint16_t keycode, keyrecord_t *record) {
  311. # ifdef COMBO_MUST_PRESS_IN_ORDER_PER_COMBO
  312. if (!get_combo_must_press_in_order(combo_index, combo)) {
  313. return true;
  314. }
  315. # endif
  316. if (
  317. // The `state` bit for the key being pressed.
  318. (1 << key_index) ==
  319. // The *next* combo key's bit.
  320. (COMBO_STATE(combo) + 1)
  321. // E.g. two keys already pressed: `state == 11`.
  322. // Next possible `state` is `111`.
  323. // So the needed bit is `100` which we get with `11 + 1`.
  324. ) {
  325. return true;
  326. }
  327. return false;
  328. }
  329. #endif
  330. static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record, uint16_t combo_index) {
  331. uint8_t key_count = 0;
  332. uint16_t key_index = -1;
  333. _find_key_index_and_count(combo->keys, keycode, &key_index, &key_count);
  334. /* Continue processing if key isn't part of current combo. */
  335. if (-1 == (int16_t)key_index) {
  336. return false;
  337. }
  338. bool key_is_part_of_combo = (!COMBO_DISABLED(combo) && is_combo_enabled()
  339. #if defined(COMBO_MUST_PRESS_IN_ORDER) || defined(COMBO_MUST_PRESS_IN_ORDER_PER_COMBO)
  340. && keys_pressed_in_order(combo_index, combo, key_index, keycode, record)
  341. #endif
  342. #ifdef COMBO_SHOULD_TRIGGER
  343. && combo_should_trigger(combo_index, combo, keycode, record)
  344. #endif
  345. );
  346. if (record->event.pressed && key_is_part_of_combo) {
  347. uint16_t time = _get_combo_term(combo_index, combo);
  348. if (!COMBO_ACTIVE(combo)) {
  349. KEY_STATE_DOWN(combo->state, key_index);
  350. if (longest_term < time) {
  351. longest_term = time;
  352. }
  353. }
  354. if (ALL_COMBO_KEYS_ARE_DOWN(COMBO_STATE(combo), key_count)) {
  355. /* Combo was fully pressed */
  356. /* Buffer the combo so we can fire it after COMBO_TERM */
  357. #ifndef COMBO_NO_TIMER
  358. /* Don't buffer this combo if its combo term has passed. */
  359. if (timer && timer_elapsed(timer) > time) {
  360. DISABLE_COMBO(combo);
  361. return true;
  362. } else
  363. #endif
  364. {
  365. // disable readied combos that overlap with this combo
  366. combo_t *drop = NULL;
  367. for (uint8_t combo_buffer_i = combo_buffer_read; combo_buffer_i != combo_buffer_write; INCREMENT_MOD(combo_buffer_i)) {
  368. queued_combo_t *qcombo = &combo_buffer[combo_buffer_i];
  369. combo_t * buffered_combo = &key_combos[qcombo->combo_index];
  370. if ((drop = overlaps(buffered_combo, combo))) {
  371. DISABLE_COMBO(drop);
  372. if (drop == combo) {
  373. // stop checking for overlaps if dropped combo was current combo.
  374. break;
  375. } else if (combo_buffer_i == combo_buffer_read && drop == buffered_combo) {
  376. /* Drop the disabled buffered combo from the buffer if
  377. * it is in the beginning of the buffer. */
  378. INCREMENT_MOD(combo_buffer_read);
  379. }
  380. }
  381. }
  382. if (drop != combo) {
  383. // save this combo to buffer
  384. combo_buffer[combo_buffer_write] = (queued_combo_t){
  385. .combo_index = combo_index,
  386. };
  387. INCREMENT_MOD(combo_buffer_write);
  388. // get possible longer waiting time for tap-/hold-only combos.
  389. longest_term = _get_wait_time(combo_index, combo);
  390. }
  391. } // if timer elapsed end
  392. }
  393. } else {
  394. // chord releases
  395. if (!COMBO_ACTIVE(combo) && ALL_COMBO_KEYS_ARE_DOWN(COMBO_STATE(combo), key_count)) {
  396. /* First key quickly released */
  397. if (COMBO_DISABLED(combo) || _get_combo_must_hold(combo_index, combo)) {
  398. // combo wasn't tappable, disable it and drop it from buffer.
  399. drop_combo_from_buffer(combo_index);
  400. key_is_part_of_combo = false;
  401. }
  402. #ifdef COMBO_MUST_TAP_PER_COMBO
  403. else if (get_combo_must_tap(combo_index, combo)) {
  404. // immediately apply tap-only combo
  405. apply_combo(combo_index, combo);
  406. apply_combos(); // also apply other prepared combos and dump key buffer
  407. # ifdef COMBO_PROCESS_KEY_RELEASE
  408. if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
  409. release_combo(combo_index, combo);
  410. }
  411. # endif
  412. }
  413. #endif
  414. } else if (COMBO_ACTIVE(combo) && ONLY_ONE_KEY_IS_DOWN(COMBO_STATE(combo)) && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)) {
  415. /* last key released */
  416. release_combo(combo_index, combo);
  417. key_is_part_of_combo = true;
  418. #ifdef COMBO_PROCESS_KEY_RELEASE
  419. process_combo_key_release(combo_index, combo, key_index, keycode);
  420. #endif
  421. } else if (COMBO_ACTIVE(combo) && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index)) {
  422. /* first or middle key released */
  423. key_is_part_of_combo = true;
  424. #ifdef COMBO_PROCESS_KEY_RELEASE
  425. if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
  426. release_combo(combo_index, combo);
  427. }
  428. #endif
  429. } else {
  430. /* The released key was part of an incomplete combo */
  431. key_is_part_of_combo = false;
  432. }
  433. KEY_STATE_UP(combo->state, key_index);
  434. }
  435. return key_is_part_of_combo;
  436. }
  437. bool process_combo(uint16_t keycode, keyrecord_t *record) {
  438. bool is_combo_key = false;
  439. bool no_combo_keys_pressed = true;
  440. if (keycode == CMB_ON && record->event.pressed) {
  441. combo_enable();
  442. return true;
  443. }
  444. if (keycode == CMB_OFF && record->event.pressed) {
  445. combo_disable();
  446. return true;
  447. }
  448. if (keycode == CMB_TOG && record->event.pressed) {
  449. combo_toggle();
  450. return true;
  451. }
  452. #ifdef COMBO_ONLY_FROM_LAYER
  453. /* Only check keycodes from one layer. */
  454. keycode = keymap_key_to_keycode(COMBO_ONLY_FROM_LAYER, record->event.key);
  455. #endif
  456. for (uint16_t idx = 0; idx < COMBO_LEN; ++idx) {
  457. combo_t *combo = &key_combos[idx];
  458. is_combo_key |= process_single_combo(combo, keycode, record, idx);
  459. no_combo_keys_pressed = no_combo_keys_pressed && (NO_COMBO_KEYS_ARE_DOWN || COMBO_ACTIVE(combo) || COMBO_DISABLED(combo));
  460. }
  461. if (record->event.pressed && is_combo_key) {
  462. #ifndef COMBO_NO_TIMER
  463. # ifdef COMBO_STRICT_TIMER
  464. if (!timer) {
  465. // timer is set only on the first key
  466. timer = timer_read();
  467. }
  468. # else
  469. timer = timer_read();
  470. # endif
  471. #endif
  472. if (key_buffer_size < COMBO_KEY_BUFFER_LENGTH) {
  473. key_buffer[key_buffer_size++] = (queued_record_t){
  474. .record = *record,
  475. .keycode = keycode,
  476. .combo_index = -1, // this will be set when applying combos
  477. };
  478. }
  479. } else {
  480. if (combo_buffer_read != combo_buffer_write) {
  481. // some combo is prepared
  482. apply_combos();
  483. } else {
  484. // reset state if there are no combo keys pressed at all
  485. dump_key_buffer();
  486. #ifndef COMBO_NO_TIMER
  487. timer = 0;
  488. #endif
  489. clear_combos();
  490. }
  491. }
  492. return !is_combo_key;
  493. }
  494. void combo_task(void) {
  495. if (!b_combo_enable) {
  496. return;
  497. }
  498. #ifndef COMBO_NO_TIMER
  499. if (timer && timer_elapsed(timer) > longest_term) {
  500. if (combo_buffer_read != combo_buffer_write) {
  501. apply_combos();
  502. longest_term = 0;
  503. timer = 0;
  504. } else {
  505. dump_key_buffer();
  506. timer = 0;
  507. clear_combos();
  508. }
  509. }
  510. #endif
  511. }
  512. void combo_enable(void) { b_combo_enable = true; }
  513. void combo_disable(void) {
  514. #ifndef COMBO_NO_TIMER
  515. timer = 0;
  516. #endif
  517. b_combo_enable = false;
  518. combo_buffer_read = combo_buffer_write;
  519. clear_combos();
  520. dump_key_buffer();
  521. }
  522. void combo_toggle(void) {
  523. if (b_combo_enable) {
  524. combo_disable();
  525. } else {
  526. combo_enable();
  527. }
  528. }
  529. bool is_combo_enabled(void) { return b_combo_enable; }