From 1a19eb78f14ae68378a19d2e71950455a2232d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 5 Nov 2018 20:33:56 +0100 Subject: [PATCH] Add offset to cycle to allow stepping in reverse --- keyboards/whitefox/keymaps/konstantin/keymap.c | 2 +- quantum/process_keycode/process_unicode_common.c | 4 ++-- quantum/process_keycode/process_unicode_common.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c index ac03d675597..07e6b8cbc15 100644 --- a/keyboards/whitefox/keymaps/konstantin/keymap.c +++ b/keyboards/whitefox/keymaps/konstantin/keymap.c @@ -38,7 +38,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case CYCLEUC: - if (record->event.pressed) { cycle_unicode_input_mode(); } + if (record->event.pressed) { cycle_unicode_input_mode(+1); } return false; case NUMPAD: diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index e173e634998..0cdfe7939ed 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -56,9 +56,9 @@ void unicode_input_mode_init(void) { dprintf("input_mode init to: %u\n", unicode_config.input_mode); } -void cycle_unicode_input_mode(void) { +void cycle_unicode_input_mode(uint8_t offset) { #if UNICODE_SELECTED_MODES != -1 - selected_index = (selected_index + 1) % selected_count; + selected_index = (selected_index + offset) % selected_count; unicode_config.input_mode = selected[selected_index]; #if UNICODE_CYCLE_PERSIST persist_unicode_input_mode(); diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index 4d610273959..b9038f2e882 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -49,7 +49,7 @@ extern unicode_config_t unicode_config; void set_unicode_input_mode(uint8_t os_target); uint8_t get_unicode_input_mode(void); void unicode_input_mode_init(void); -void cycle_unicode_input_mode(void); +void cycle_unicode_input_mode(uint8_t offset); void persist_unicode_input_mode(void); void unicode_input_start(void);