Changeset 167 for trunk/ICeCoffEE/ICeCoffEE/APEMain.m
- Timestamp:
- 04/18/05 05:30:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/APEMain.m
r142 r167 67 67 CFBundleRef ICCF_bundle; 68 68 69 void APEBundleMain(CFBundleRef inBundle) 69 // With APE 1.3, if we're in the exclude list, APEBundleMainEarlyLoad doesn't get invoked; don't need to use APETools. But we need to do our own management to avoid loading in non-GUI appllications. 70 Boolean ICCF_shouldLoad; 71 72 void APEBundleMainEarlyLoad(CFBundleRef inBundle, CFStringRef inAPEToolsApplicationID) 70 73 { 71 74 ICCF_MigratePrefs(); … … 77 80 SAFE_RELEASE(icVersionRef); 78 81 79 // first check if this application is in the exclude list; 80 // if it is, simply return and do not apply any patches. 81 // APETools will help us with that; APE Manager will take care of 82 // exclude list management for us. 83 if (APEToolsIsInExcludeList(kICBundleIdentifier, NULL)) { 84 ICapeprintf("ICeCoffEE APE: not loading as this application is excluded.\n"); 85 return; 86 } 82 ICCF_shouldLoad = false; 87 83 88 84 CPSProcessSerNum psn; … … 106 102 return; 107 103 #endif 108 } 109 ICapeprintf("ICeCoffEE APE: got process attributes = 0x%lx\n", info.Attributes); 110 if (info.Attributes & (kCPSBGOnlyAttr | kCPSUIElementAttr | kCPSFullScreenAttr)) { 111 ICapeprintf("ICeCoffEE APE: not loading as this application is background-only\n"); 112 return; 113 } 104 } else { 105 ICapeprintf("ICeCoffEE APE: got process attributes = 0x%lx\n", info.Attributes); 106 if (info.Attributes & (kCPSBGOnlyAttr | kCPSUIElementAttr | kCPSFullScreenAttr)) { 107 ICapeprintf("ICeCoffEE APE: not loading as this application is background-only\n"); 108 return; 109 } 110 } 111 ICCF_shouldLoad = true; 112 } 113 114 Boolean ICCF_CFBundleIDMatches(CFStringRef bundleID, CFStringRef test) { 115 return CFStringCompare(bundleID, test, kCFCompareCaseInsensitive) == kCFCompareEqualTo; 116 } 117 118 void APEBundleMainLateLoad(CFBundleRef inBundle, CFStringRef inAPEToolsApplicationID) 119 { 120 if (!ICCF_shouldLoad) return; 114 121 115 122 ICCF_bundle = CFBundleGetBundleWithIdentifier(kICBundleIdentifier); … … 119 126 // XXX handle patching error return from ICCF_PatchMethod 120 127 if (bundleID != NULL) { 121 if (CFStringCompare(bundleID, CFSTR("com.apple.projectbuilder"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { 128 if (ICCF_CFBundleIDMatches(bundleID, CFSTR("com.apple.projectbuilder")) || 129 ICCF_CFBundleIDMatches(bundleID, CFSTR("com.apple.xcode"))) { 122 130 ICCF_PatchMethod("PBXTextView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:"); 123 131 ICapeprintf("ICeCoffEE APE: loaded in PBXTextView for PB!\n"); 124 132 shouldLoadInNSTextView = NO; 125 } else if ( CFStringCompare(bundleID, CFSTR("com.apple.terminal"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {133 } else if (ICCF_CFBundleIDMatches(bundleID, CFSTR("com.apple.terminal"))) { 126 134 ICCF_PatchMethod("TermSubview", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:") && 127 135 ICCF_PatchMethod("TermSubview", "ICeCoffEETerminal", "ICECoffEETermSubviewSuper", "selectedRange") && … … 132 140 ICCF_PatchMethod("TermSubview", "ICeCoffEETerminal", "ICECoffEETermSubviewSuper", "_optionClickEvent:::") , 133 141 ICapeprintf("ICeCoffEE APE: loaded in TermSubview for Terminal!\n"); 134 } else if (CFStringCompare(bundleID, CFSTR("com.apple.safari"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { 135 #if ICCF_WEBKIT 136 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") && 137 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") && 138 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:") , 139 ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for Safari!\n"); 140 #endif 141 } 142 } 143 142 } else if (ICCF_CFBundleIDMatches(bundleID, CFSTR("org.mozilla.navigator"))) { 143 ICCF_PatchMethod("ChildView", "ICeCoffEEMenuOnly", "ICeCoffEEMenuSuper", "menuForEvent:"); 144 ICapeprintf("ICeCoffEE APE: loaded in ChildView for Camino\n"); 145 } 146 } 147 148 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseUp:") && 149 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "mouseDown:") && 150 ICCF_PatchMethod("WebHTMLView", "ICeCoffEEWebKit", "ICeCoffEEWebKitSuper", "menuForEvent:"), 151 ICapeprintf("ICeCoffEE APE: loaded in WebHTMLView for WebKit/Safari\n"); 152 144 153 if (shouldLoadInNSTextView) { 145 154 ICCF_PatchMethod("NSTextView", "ICeCoffEE", "ICeCoffEESuper", "mouseDown:") &&
Note:
See TracChangeset
for help on using the changeset viewer.