From 3015f191a5d9268cb5ca7a0256597d3d76f4d200 Mon Sep 17 00:00:00 2001 From: tmk Date: Sun, 13 Feb 2011 23:58:12 +0900 Subject: [PATCH] fixed: not to send key if fn_keycode is modifier --- hhkb/keymap.c | 34 +++++++++++++++++++++++++++------- layer.c | 4 ++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/hhkb/keymap.c b/hhkb/keymap.c index 137ab7de..d6acf459 100644 --- a/hhkb/keymap.c +++ b/hhkb/keymap.c @@ -42,9 +42,9 @@ static const uint8_t PROGMEM fn_layer[] = { 2, // Fn2 3, // Fn3 4, // Fn4 - 0, // Fn5 + 5, // Fn5 0, // Fn6 - 1 // Fn7 + 0 // Fn7 }; // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. @@ -54,8 +54,8 @@ static const uint8_t PROGMEM fn_keycode[] = { KB_NO, // Fn1 KB_SLSH, // Fn2 KB_SCLN, // Fn3 - KB_SPC, // Fn4 - KB_NO, // Fn5 + KB_RGUI, // Fn4 + KB_SPC, // Fn5 KB_NO, // Fn6 KB_NO // Fn7 }; @@ -71,14 +71,14 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------| * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1| * `-----------------------------------------------------------' - * |Gui|Alt |Fn4 |Alt |Fn7| + * |Gui|Alt |Fn5 |Alt |Fn4| * `-------------------------------------------' */ KEYMAP(KB_ESC, KB_1, KB_2, KB_3, KB_4, KB_5, KB_6, KB_7, KB_8, KB_9, KB_0, KB_MINS,KB_EQL, KB_BSLS,KB_GRV, \ KB_TAB, KB_Q, KB_W, KB_E, KB_R, KB_T, KB_Y, KB_U, KB_I, KB_O, KB_P, KB_LBRC,KB_RBRC,KB_BSPC, \ KB_LCTL,KB_A, KB_S, KB_D, KB_F, KB_G, KB_H, KB_J, KB_K, KB_L, KB_FN3, KB_QUOT,KB_ENT, \ KB_LSFT,KB_Z, KB_X, KB_C, KB_V, KB_B, KB_N, KB_M, KB_COMM,KB_DOT, KB_FN2, KB_RSFT,KB_FN1, \ - KB_LGUI,KB_LALT,KB_FN4, KB_RALT,KB_RGUI), + KB_LGUI,KB_LALT,KB_FN5, KB_RALT,KB_FN4), /* Layer 1: HHKB mode (HHKB Fn) * ,-----------------------------------------------------------. @@ -155,7 +155,27 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KB_BSPC,KB_P, KB_O, KB_I, KB_U, KB_Y, KB_T, KB_R, KB_E, KB_W, KB_Q, KB_NO, KB_NO, KB_TAB, \ KB_LCTL,KB_SCLN,KB_L, KB_K, KB_J, KB_H, KB_G, KB_F, KB_D, KB_S, KB_A, KB_RCTL,KB_RCTL, \ KB_LSFT,KB_SLSH,KB_DOT, KB_COMM,KB_M, KB_N, KB_B, KB_V, KB_C, KB_X, KB_Z, KB_RSFT,KB_NO, \ - KB_LGUI,KB_LALT,KB_FN4, KB_RALT,KB_RGUI) + KB_LGUI,KB_LALT,KB_SPC, KB_RALT,KB_FN4), + + /* Layer 5: Mouse mode + * ,-----------------------------------------------------------. + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| + * |-----------------------------------------------------------| + * |Tab |MwL|MwU|McU|MwD|MwR|MwL|MwD|MwU|MwR| | | |Backs| + * |-----------------------------------------------------------| + * |Contro| |McL|McD|McR| |McL|McD|McU|McR|Mb1| |Return | + * |-----------------------------------------------------------| + * |Shift |Mb4|Mb5|Mb1|Mb2|Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | | + * `-----------------------------------------------------------' + * |Gui |Alt |xxxxxxxxxxxxxxxxxxxxxxx|Alt |Gui| + * `--------------------------------------------' + * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel + */ + KEYMAP(KB_ESC, KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, KB_INS, KB_DEL, \ + KB_TAB, KB_WH_L,KB_WH_U,KB_MS_U,KB_WH_D,KB_WH_R,KB_WH_L,KB_WH_D,KB_WH_U,KB_WH_R,KB_NO, KB_NO, KB_NO, KB_BSPC, \ + KB_LCTL,KB_NO, KB_MS_L,KB_MS_D,KB_MS_R,KB_NO, KB_MS_L,KB_MS_D,KB_MS_U,KB_MS_R,KB_BTN1,KB_NO, KB_ENT, \ + KB_LSFT,KB_BTN4,KB_BTN5,KB_BTN1,KB_BTN2,KB_BTN3,KB_BTN2,KB_BTN1,KB_BTN4,KB_BTN5,KB_NO, KB_RSFT,KB_NO, \ + KB_LGUI,KB_LALT,KB_FN5, KB_RALT,KB_RGUI), }; diff --git a/layer.c b/layer.c index 0fe06a45..90314e44 100644 --- a/layer.c +++ b/layer.c @@ -106,8 +106,8 @@ void layer_switching(uint8_t fn_bits) // send only Fn key first host_swap_keyboard_report(); host_clear_keyboard_report(); - host_add_code(keymap_fn_keycode(_fn_to_send)); // TODO: do all Fn keys host_set_mods(last_mods); + host_add_code(keymap_fn_keycode(_fn_to_send)); // TODO: do all Fn keys host_send_keyboard_report(); host_swap_keyboard_report(); sent_fn |= _fn_to_send; @@ -152,8 +152,8 @@ void layer_switching(uint8_t fn_bits) // send only Fn key first host_swap_keyboard_report(); host_clear_keyboard_report(); - host_add_code(keymap_fn_keycode(fn_changed)); // TODO: do all Fn keys host_set_mods(last_mods); + host_add_code(keymap_fn_keycode(fn_changed)); // TODO: do all Fn keys host_send_keyboard_report(); host_swap_keyboard_report(); sent_fn |= fn_changed; -- 2.46.2