From 8a3b565c801c637fba68ccdd2f1b59a49b741223 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 20 Jan 2012 00:25:11 -0800 Subject: Use SBSSetInterceptsMenuButtonForever() to lock menu button. --- MobileCydia.mm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'MobileCydia.mm') 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(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever")); + BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast(dlsym(RTLD_DEFAULT, "GSSystemHasCapability")); bool fast = GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("armv7")); -- cgit v1.2.3