KeyRemap4MacBookで、Escキー押下で、英数キーも押下するパッチを書いた

これは何?


KeyRemap4MacBookなる OS/X 用のキーボードリマッパーのパッチです
Escキー押下で、英数キーも押下する設定を追加します
ビルドの手順については、オフィシャルの説明を参照して下さい

注意点


時たま、かなモードに戻ると全角英数入力になる時があるみたいです
ご仕様の際は自己責任でお願いします

早速ソース

diff -cr -c KeyRemap4MacBook-5.1.85 KeyRemap4MacBook-5.1.85.bak
Only in KeyRemap4MacBook-5.1.85: KeyRemap4MacBook-5.1.85.pkg
Only in KeyRemap4MacBook-5.1.85: KeyRemap4MacBook-5.1.85.pkg.tar.gz
diff -cr -c KeyRemap4MacBook-5.1.85/files/prefpane/checkbox.xml KeyRemap4MacBook-5.1.85.bak/files/prefpane/checkbox.xml
*** KeyRemap4MacBook-5.1.85/files/prefpane/checkbox.xml	2009-10-05 11:13:55.000000000 +0900
--- KeyRemap4MacBook-5.1.85.bak/files/prefpane/checkbox.xml	2009-09-23 19:13:04.000000000 +0900
***************
*** 522,531 ****
            <sysctl>remap.escape2rightclick</sysctl>
            <autogen>--KeyToPointingButton-- KeyCode::ESCAPE, PointingButton::RIGHT</autogen>
          </item>
-         <item>
-           <name>Escape to KANA and Escape</name>
-           <sysctl>remap.escape2eisuandescape</sysctl>
-         </item>
        </list>
      </item>
  
--- 522,527 ----
diff -cr -c KeyRemap4MacBook-5.1.85/files/share/reset KeyRemap4MacBook-5.1.85.bak/files/share/reset
*** KeyRemap4MacBook-5.1.85/files/share/reset	2009-10-05 11:51:58.000000000 +0900
--- KeyRemap4MacBook-5.1.85.bak/files/share/reset	2009-09-26 09:16:36.000000000 +0900
***************
*** 85,91 ****
  remap.escape2commandL 0
  remap.escape2backquote 0
  remap.escape2rightclick 0
- remap.escape2eisuandescape 0
  remap.fn2commandL 0
  remap.fn2controlL 0
  remap.fn2controlL_commandR2fn 0
--- 85,90 ----
Only in KeyRemap4MacBook-5.1.85/src/core/kext: build
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.config.default.hpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.config.hpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.config_SYSCTL.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.config_register.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.config_unregister.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call_consumer.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call_kom.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call_komc.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call_mhkk.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_call_pointing_relative.cpp
Only in KeyRemap4MacBook-5.1.85/src/core/kext/config/output: include.remapcode_func.cpp
diff -cr -c KeyRemap4MacBook-5.1.85/src/core/kext/remap.cpp KeyRemap4MacBook-5.1.85.bak/src/core/kext/remap.cpp
*** KeyRemap4MacBook-5.1.85/src/core/kext/remap.cpp	2009-10-05 11:49:18.000000000 +0900
--- KeyRemap4MacBook-5.1.85.bak/src/core/kext/remap.cpp	2009-09-26 09:04:33.000000000 +0900
***************
*** 191,206 ****
    }
  
    static void
-   remap_escape2eisuandescape(const RemapParams &remapParams)
-   {
- 	if (! config.remap_escape2eisuandescape) return;
- 
- 	if (RemapUtil::isKeyDown(remapParams, KeyCode::ESCAPE)) {
- 	  ListFireExtraKey::addKey(0, KeyCode::JIS_EISUU);
- 	}
-   }
- 
-   static void
    remap_jis_jansi(const RemapParams &remapParams)
    {
      if (! config.remap_jis_jansi) return;
--- 191,196 ----
***************
*** 273,279 ****
    remap_jis_yen2backslash(remapParams);
  
    remap_jis_app_vi_eisuu2eisuu_escape(remapParams);
-   remap_escape2eisuandescape(remapParams);
  
    remap_jis_jansi(remapParams);
    remap_jis_layout_kawashima(remapParams);
--- 263,268 ----

動機


コマンドライン上のvimでESC押しても、かなモードが解除されないのが不便
さらに、vimの癖で、いろんな時にかなモードを解除しようと、ESCを押してしまうので

注意点


適当に書いたのでお作法とか、ネーミングとか間違えてるかも知れないです