diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2012-01-20 00:25:11 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2012-01-20 00:26:30 -0800 |
commit | 8a3b565c801c637fba68ccdd2f1b59a49b741223 (patch) | |
tree | 4ec38b7de11746d2b03aa1d5bd5c45bc9cbb6b8f /MobileCydia.mm | |
parent | 2ef6faadc0910c127a209d38c53e04c401899ee6 (diff) |
Use SBSSetInterceptsMenuButtonForever() to lock menu button.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index f789b46..826b316 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -262,6 +262,8 @@ static NSString *Warning_; static bool AprilFools_; +static void (*$SBSSetInterceptsMenuButtonForever)(bool); + static bool IsReachable(const char *name) { SCNetworkReachabilityFlags flags; { SCNetworkReachabilityRef reachability(SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, name)); @@ -9341,11 +9343,17 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi @implementation Cydia - (void) lockSuspend { - ++locked_; + if (locked_++ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(true); + } } - (void) unlockSuspend { - --locked_; + if (--locked_ == 0) { + if ($SBSSetInterceptsMenuButtonForever != NULL) + (*$SBSSetInterceptsMenuButtonForever)(false); + } } - (void) beginUpdate { @@ -10829,6 +10837,8 @@ int main(int argc, char *argv[]) { //UIKeyboardDisableAutomaticAppearance(); /* }}} */ + $SBSSetInterceptsMenuButtonForever = reinterpret_cast<void (*)(bool)>(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever")); + BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability")); bool fast = GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("armv7")); |