summaryrefslogtreecommitdiff
path: root/hhkb/keymap.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2010-10-19 01:03:27 +0900
committertmk <nobody@nowhere>2010-10-19 01:03:27 +0900
commit9d7979931e0037fc5ddc77a2cb895eb055501f34 (patch)
treebed7080ff4375c04beb0526d423a71c88a5e3873 /hhkb/keymap.c
parent54b5bafaacf0d7863b7bdb84dd69cbc80db77956 (diff)
FIX: clear keyboard_keys.
NOT change layer when one more Fn keys pressed/other than Fn key pressed
Diffstat (limited to 'hhkb/keymap.c')
-rw-r--r--hhkb/keymap.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hhkb/keymap.c b/hhkb/keymap.c
index d7e6bbe3be..572f530b93 100644
--- a/hhkb/keymap.c
+++ b/hhkb/keymap.c
@@ -152,12 +152,17 @@ int get_layer(void) {
for (int col = 0; col < MATRIX_ROWS; col++) {
if (matrix[row] & 1<<col) continue; // NOT pressed
uint8_t code = get_keycode(0, row, col);
- if (code == FN_1) layer = 1;
- else if (code == FN_2) layer = 2;
- else if (code == FN_3) layer = 3;
- else if (code == FN_4) layer = 4;
+
+ // NOT change current_layer when one more Fn keys pressed
+ // when other than Fn key pressed
+ if (code == FN_1) layer = layer ? current_layer : 1;
+ else if (code == FN_2) layer = layer ? current_layer : 2;
+ else if (code == FN_3) layer = layer ? current_layer : 3;
+ else if (code == FN_4) layer = layer ? current_layer : 4;
else if (KB_LCTRL <= code && code <= KB_RGUI)
modifiers |= 1<<(code & 0x07);
+ else // other_key_pressed
+ layer = current_layer;
}
}