summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.c1
-rw-r--r--quantum/process_keycode/process_leader.c4
-rw-r--r--quantum/process_keycode/process_steno.c9
-rw-r--r--quantum/quantum.c19
-rw-r--r--quantum/visualizer/visualizer.mk2
5 files changed, 25 insertions, 10 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 1c522e8b8..b1460c53c 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -169,6 +169,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
}
// translates key to keycode
+__attribute__ ((weak))
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
// Read entire word (16bits)
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index 473906d65..e0fe47654 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -14,6 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef DISABLE_LEADER
+
#include "process_leader.h"
__attribute__ ((weak))
@@ -52,3 +54,5 @@ bool process_leader(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
+
+#endif
diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c
index 71e5e8ff1..16bbf154f 100644
--- a/quantum/process_keycode/process_steno.c
+++ b/quantum/process_keycode/process_steno.c
@@ -15,6 +15,7 @@
*/
#include "process_steno.h"
#include "quantum_keycodes.h"
+#include "eeprom.h"
#include "keymap_steno.h"
#include "virtser.h"
@@ -54,8 +55,9 @@
#define BOLT_STATE_SIZE 4
#define GEMINI_STATE_SIZE 6
+#define MAX_STATE_SIZE GEMINI_STATE_SIZE
-uint8_t state[MAX(BOLT_STATE_SIZE, GEMINI_STATE_SIZE)] = {0};
+uint8_t state[MAX_STATE_SIZE] = {0};
uint8_t pressed = 0;
steno_mode_t mode;
@@ -68,11 +70,8 @@ uint8_t boltmap[64] = {
TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R
};
-#define BOLTMAP_MASK (sizeof(boltmap) - 1)
-
-
void steno_clear_state(void) {
- memset(state, 0, sizeof(state));
+ __builtin_memset(state, 0, sizeof(state));
}
void steno_init() {
diff --git a/quantum/quantum.c b/quantum/quantum.c
index aac1d07a9..65213eaea 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -161,6 +161,11 @@ void reset_keyboard(void) {
static bool shift_interrupted[2] = {0, 0};
static uint16_t scs_timer[2] = {0, 0};
+/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
+ * Used to ensure that the correct keycode is released if the key is released.
+ */
+static bool grave_esc_was_shifted = false;
+
bool process_record_quantum(keyrecord_t *record) {
/* This gets the keycode from the key pressed */
@@ -475,10 +480,9 @@ bool process_record_quantum(keyrecord_t *record) {
// break;
}
case GRAVE_ESC: {
- void (*method)(uint8_t) = (record->event.pressed) ? &add_key : &del_key;
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)
|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)));
-
+
#ifdef GRAVE_ESC_CTRL_OVERRIDE
// if CTRL is pressed, ESC is always read as ESC, even if SHIFT or GUI is pressed.
// this is handy for the ctrl+shift+esc shortcut on windows, among other things.
@@ -486,8 +490,15 @@ bool process_record_quantum(keyrecord_t *record) {
shifted = 0;
#endif
- method(shifted ? KC_GRAVE : KC_ESCAPE);
- send_keyboard_report();
+ if (record->event.pressed) {
+ grave_esc_was_shifted = shifted;
+ add_key(shifted ? KC_GRAVE : KC_ESCAPE);
+ }
+ else {
+ del_key(grave_esc_was_shifted ? KC_GRAVE : KC_ESCAPE);
+ }
+
+ send_keyboard_report();
}
default: {
shift_interrupted[0] = true;
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 102d23b7e..671b63ea2 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -91,7 +91,7 @@ GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRI
GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)"
ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
- SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
+ SRC += $(KEYMAP_PATH)/visualizer.c
else
ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","")