preliminary patch to map capslock to escape
Brought to you by:
mbaltaks
Hi,
as posted at https://sourceforge.net/forum/forum.php?thread_id=3164359&forum_id=221238 I have a preliminary patch to map the CapsLock key to Escape. See my posting about the status of this initial patch, there are some things missing (GUI), and note the feature is hardcoded at the moment, in order to allow me testing it.
preliminary, incomplete patch
I've got an alternate patch, which is very similar, but allows for changing with the GUI.
I don't think the .nib file changes appear in the diff, I'll try to get a bdiff working.
And I am not sure how to add an attachment!
diff --git a/kext/Common.h b/kext/Common.h
index 3d235e6..06fc83b 100644
--- a/kext/Common.h
+++ b/kext/Common.h
@@ -106,6 +106,9 @@ int KeyToModifier(unsigned * eventType,
#define SHIFT_KEY_R 60
#define CONTROL_KEY 59
#define CONTROL_KEY_R 62
+// Added by Matthew Schinckel <matt@schinckel.net>
+#define ESC_KEY 53
+// End Matthew Schinckel addition
#define CAPSLOCK_KEY 57
// special caps key for TiBook (and probably other models)
#define SPECIAL_CAPSLOCK_KEY 127
@@ -218,7 +221,9 @@ enum
#define OPTION_KEY_R_TO_ENTER 536870912
#define SWAP_DELETE_AND_FORWARD_DELETE 1073741824
//End Addition by Sastira
-//#define 2147483648
+// Added by Matthew Schinckel <matt@schinckel.net>
+#define CAPSLOCK_TO_ESCAPE 2147483648
+// End Matthew Schinckel addition
#define NEED_NEW_INT_VAR 4294967296
#endif // _Common_H_
diff --git a/kext/Substitute.cpp b/kext/Substitute.cpp
index 58000ac..d0bbe7b 100644
--- a/kext/Substitute.cpp
+++ b/kext/Substitute.cpp
@@ -938,8 +938,15 @@ if (dcConfig != 0)
// FN_FLAG is needed for Office
*flags = FN_FLAG;
}
- //End Addition by Sastira
-
+ //End Addition by Sastira
+ // Added by Matthew Schinckel <matt@schinckel.net>
+ else if (dcConfig & CAPSLOCK_TO_ESCAPE)
+ {
+ removeFlags |= CAPSLOCK_FLAG;
+ *key = ESC_KEY;
+ return_value = kSwitch;
+ }
+ // End addition by Matthew Schinckel
break;
}
diff --git a/prefpane/DoubleCommandPrefPane.xcodeproj/project.pbxproj b/prefpane/DoubleCommandPrefPane.xcodeproj/project.pbxproj
index aeaf5ae..65dae77 100644
--- a/prefpane/DoubleCommandPrefPane.xcodeproj/project.pbxproj
+++ b/prefpane/DoubleCommandPrefPane.xcodeproj/project.pbxproj
@@ -172,9 +172,11 @@
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 00F60E45094F764D00C5D712 /* Build configuration list for PBXProject "DoubleCommandPrefPane" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 089C166AFE841209C02AAC07 /* DCP_prefPane */;
projectDirPath = "";
+ projectRoot = "";
targets = (
8D5B49AC048680CD000E48DA /* DoubleCommand Prefences */,
);
@@ -299,7 +301,6 @@
INSTALL_PATH = "$(HOME)/Library/Bundles";
LIBRARY_SEARCH_PATHS = "";
LIBRARY_STYLE = Bundle;
- OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
diff --git a/prefpane/English.lproj/MainMenu.nib/info.nib b/prefpane/English.lproj/MainMenu.nib/info.nib
index 5158bac..663b5eb 100644
--- a/prefpane/English.lproj/MainMenu.nib/info.nib
+++ b/prefpane/English.lproj/MainMenu.nib/info.nib
@@ -3,9 +3,9 @@
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
- <string>629</string>
+ <string>677</string>
<key>IBLastKnownRelativeProjectPath</key>
- <string>../../DoubleCommandPrefPane.xcodeproj</string>
+ <string>../DoubleCommandPrefPane.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
@@ -13,7 +13,7 @@
<integer>368</integer>
</array>
<key>IBSystem Version</key>
- <string>9B18</string>
+ <string>9G55</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
diff --git a/prefpane/English.lproj/MainMenu.nib/keyedobjects.nib b/prefpane/English.lproj/MainMenu.nib/keyedobjects.nib
index 4b4e9a7..a813a38 100644
Binary files a/prefpane/English.lproj/MainMenu.nib/keyedobjects.nib and b/prefpane/English.lproj/MainMenu.nib/keyedobjects.nib differ