]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
ESC/GRAVE/TILDE better handling (#1307)
authortengg <tengg@users.noreply.github.com>
Thu, 18 May 2017 01:20:01 +0000 (21:20 -0400)
committerskullydazed <skullydazed@users.noreply.github.com>
Thu, 18 May 2017 01:20:01 +0000 (18:20 -0700)
* revise HHKB bootloader_size to 4096 such that sw reset works

* cleanup esr/grave/tilde handling function

keyboards/clueboard/keymaps/mac_optimized/keymap.c

index 7ea02d27e83dbe782c3f68d8e300fbb91b9b60b2..e72733092f21d6e5d03d73e2a74420c1714dce5a 100644 (file)
@@ -50,35 +50,28 @@ const uint16_t PROGMEM fn_actions[] = {
 
 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
   static uint8_t mods_pressed;
-  static bool mod_flag;
 
   switch (id) {
     case 0:
       /* Handle the combined Grave/Esc key
        */
-      mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
-
       if (record->event.pressed) {
         /* The key is being pressed.
          */
+        mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
         if (mods_pressed) {
-          mod_flag = true;
-          add_key(KC_GRV);
-          send_keyboard_report();
+          register_code(KC_GRV);
         } else {
-          add_key(KC_ESC);
-          send_keyboard_report();
+          register_code(KC_ESC);
         }
       } else {
         /* The key is being released.
          */
-        if (mod_flag) {
-          mod_flag = false;
-          del_key(KC_GRV);
-          send_keyboard_report();
+        if (mods_pressed) {
+          mods_pressed = false;
+          unregister_code(KC_GRV);
         } else {
-          del_key(KC_ESC);
-          send_keyboard_report();
+          unregister_code(KC_ESC);
         }
       }
       break;