A Day in the Life

2008-02-07

会社の謎

何故かワイヤレスエクボコントローラが二個ある…。さてはこれでエアエクボ(エクボコントローラを持って脳内でプレイ。極めると実績250ぐらいは手に入る。)対戦でもしてろということだな。

KeyRemap4MacBook で右Option で IME をトグルできるようにする patch

win だといつも右ALTでIMEトグルするのに慣れていて、VMWare Fusion の ATOK は右ALTでトグルするようにしたら Cmd + Space トグルだと混乱しまくるようになってしまったので KeyRemap4MacBook に追加コードを書いてみた。3.0.4 がドキュメントページのコメント欄にあったので、そのソースをもとにだいたいコピペで。pkg をインストールしても一度システム環境設定を閉じないと設定画面が更新されなくてちょっとはまった><。

で、OSX 上できるようになってやった!と思いきや VMWare Fusion に右ALT(右OptionがWinでは右ALTになる)で渡ってくるキーコードがたぶんOSXのkana/eisuuに変わって本末転倒的な展開に。こっちは mayu 側で対処。

mayu の設定はこんな。

def key ROPT1 = 0x3a
def key ROPT2 = 0x70

keymap Global
  key C-H = BackSpace
  mod alt -= RAlt
  key RAlt = $ToggleIME
  key ROPT1 = $ToggleIME
  key ROPT2 = $ToggleIME

KeyRemap4MacBook 3.0.4 での patch。

Only in KeyRemap4MacBook-3.0.4: .DS_Store
diff -cr KeyRemap4MacBook-3.0.4.orig/files/prefpane/sysctl.xml KeyRemap4MacBook-3.0.4/files/prefpane/sysctl.xml
*** KeyRemap4MacBook-3.0.4.orig/files/prefpane/sysctl.xml	2008-02-06 22:32:35.000000000 +0900
--- KeyRemap4MacBook-3.0.4/files/prefpane/sysctl.xml	2008-02-07 01:22:57.000000000 +0900
***************
*** 459,464 ****
--- 459,468 ----
                Use Command_L as KANA/EISUU (toggle)
                keyremap4macbook.remap.jis_unify_kana_eisuu_to_commandL
              
+             
+               Use Option_R as KANA/EISUU (toggle)
+               keyremap4macbook.remap.jis_unify_kana_eisuu_to_optionR
+             
            
          
        
diff -cr KeyRemap4MacBook-3.0.4.orig/pkginfo/Info.plist KeyRemap4MacBook-3.0.4/pkginfo/Info.plist
*** KeyRemap4MacBook-3.0.4.orig/pkginfo/Info.plist	2008-02-06 22:36:35.000000000 +0900
--- KeyRemap4MacBook-3.0.4/pkginfo/Info.plist	2008-02-07 01:48:57.000000000 +0900
***************
*** 9,15 ****
      org.pqrs.driver.KeyRemap4MacBook
  
      CFBundleShortVersionString
!     3.0.4
  
      IFPkgFlagAllowBackRev
      
--- 9,15 ----
      org.pqrs.driver.KeyRemap4MacBook
  
      CFBundleShortVersionString
!     3.0.4_1
  
      IFPkgFlagAllowBackRev
      
diff -cr KeyRemap4MacBook-3.0.4.orig/src/kext/config.cpp KeyRemap4MacBook-3.0.4/src/kext/config.cpp
*** KeyRemap4MacBook-3.0.4.orig/src/kext/config.cpp	2008-02-06 22:18:02.000000000 +0900
--- KeyRemap4MacBook-3.0.4/src/kext/config.cpp	2008-02-07 01:39:01.000000000 +0900
***************
*** 289,294 ****
--- 289,295 ----
    SYSCTL_INT(_keyremap4macbook_remap, OID_AUTO, jis_optionR2kana, CTLTYPE_INT|CTLFLAG_RW,
               &(config.remap_jis_optionR2kana), 0, "");
  
+   //
    // ----------------------------------------
    SYSCTL_INT(_keyremap4macbook_remap, OID_AUTO, jis_shiftKana2eisuu, CTLTYPE_INT|CTLFLAG_RW,
               &(config.remap_jis_shiftKana2eisuu), 0, "");
***************
*** 302,307 ****
--- 303,311 ----
    SYSCTL_INT(_keyremap4macbook_remap, OID_AUTO, jis_unify_kana_eisuu_to_commandL, CTLTYPE_INT|CTLFLAG_RW,
               &(config.remap_jis_unify_kana_eisuu_to_commandL), 0, "");
  
+   SYSCTL_INT(_keyremap4macbook_remap, OID_AUTO, jis_unify_kana_eisuu_to_optionR, CTLTYPE_INT|CTLFLAG_RW,
+              &(config.remap_jis_unify_kana_eisuu_to_optionR), 0, "");
+   
    // ----------------------------------------
    SYSCTL_INT(_keyremap4macbook, OID_AUTO, debug, CTLTYPE_INT|CTLFLAG_RW,
               &(config.debug), 0, "");
***************
*** 436,441 ****
--- 440,446 ----
      sysctl_register_oid(&sysctl__keyremap4macbook_remap_jis_unify_eisuu_to_kana);
      sysctl_register_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_to_eisuu);
      sysctl_register_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_eisuu_to_commandL);
+     sysctl_register_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_eisuu_to_optionR);
  
      // ----------------------------------------
      sysctl_register_oid(&sysctl__keyremap4macbook_debug);
***************
*** 568,573 ****
--- 573,579 ----
      sysctl_unregister_oid(&sysctl__keyremap4macbook_remap_jis_unify_eisuu_to_kana);
      sysctl_unregister_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_to_eisuu);
      sysctl_unregister_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_eisuu_to_commandL);
+     sysctl_unregister_oid(&sysctl__keyremap4macbook_remap_jis_unify_kana_eisuu_to_optionR);
  
      // ----------------------------------------
      sysctl_unregister_oid(&sysctl__keyremap4macbook_debug);
diff -cr KeyRemap4MacBook-3.0.4.orig/src/kext/config.hpp KeyRemap4MacBook-3.0.4/src/kext/config.hpp
*** KeyRemap4MacBook-3.0.4.orig/src/kext/config.hpp	2008-02-06 22:12:53.000000000 +0900
--- KeyRemap4MacBook-3.0.4/src/kext/config.hpp	2008-02-07 01:16:19.000000000 +0900
***************
*** 124,129 ****
--- 124,130 ----
      int remap_jis_unify_eisuu_to_kana;
      int remap_jis_unify_kana_to_eisuu;
      int remap_jis_unify_kana_eisuu_to_commandL;
+     int remap_jis_unify_kana_eisuu_to_optionR;
  
      // ----------------------------------------
      int debug;
diff -cr KeyRemap4MacBook-3.0.4.orig/src/kext/remap.cpp KeyRemap4MacBook-3.0.4/src/kext/remap.cpp
*** KeyRemap4MacBook-3.0.4.orig/src/kext/remap.cpp	2008-02-06 22:24:14.000000000 +0900
--- KeyRemap4MacBook-3.0.4/src/kext/remap.cpp	2008-02-07 01:48:42.000000000 +0900
***************
*** 971,976 ****
--- 971,995 ----
        isKana = ! isKana;
      }
    }
+ 
+   void
+   remap_jis_unify_kana_eisuu_to_optionR(const RemapParams ¶ms)
+   {
+     if (! config.remap_jis_unify_kana_eisuu_to_optionR) return;
+ 
+     if (params.ex_origKey != KeyCode::OPTION_R) return;
+ 
+     static bool isKana = true;
+ 
+     if (isKana) {
+       RemapUtil::modifierToKey(params, ModifierFlag::OPTION_R, KeyCode::JIS_EISUU);
+     } else {
+       RemapUtil::modifierToKey(params, ModifierFlag::OPTION_R, KeyCode::JIS_KANA);
+     }
+     if (*(params.eventType) == KeyEvent::UP) {
+       isKana = ! isKana;
+     }
+   }
  }
  
  // ----------------------------------------------------------------------
***************
*** 1076,1081 ****
--- 1095,1101 ----
    remap_jis_unify_eisuu_to_kana(params);
    remap_jis_unify_kana_to_eisuu(params);
    remap_jis_unify_kana_eisuu_to_commandL(params);
+   remap_jis_unify_kana_eisuu_to_optionR(params);
  
    // ------------------------------------------------------------
    // *** Note: we need to call remap_emacsmode as possible late. ***
diff -cr KeyRemap4MacBook-3.0.4.orig/src/kext/version.hpp KeyRemap4MacBook-3.0.4/src/kext/version.hpp
*** KeyRemap4MacBook-3.0.4.orig/src/kext/version.hpp	2008-02-06 22:36:31.000000000 +0900
--- KeyRemap4MacBook-3.0.4/src/kext/version.hpp	2008-02-07 01:48:45.000000000 +0900
***************
*** 1 ****
! char * const config_version = "3.0.4";
--- 1 ----
! char * const config_version = "3.0.4_1";
diff -cr KeyRemap4MacBook-3.0.4.orig/version KeyRemap4MacBook-3.0.4/version
*** KeyRemap4MacBook-3.0.4.orig/version	2008-02-06 22:29:39.000000000 +0900
--- KeyRemap4MacBook-3.0.4/version	2008-02-07 01:32:42.000000000 +0900
***************
*** 1 ****
! 3.0.4
--- 1 ----
! 3.0.4_1
記事の一覧 >