]> git.saurik.com Git - cydia.git/commitdiff
Use SBSSetInterceptsMenuButtonForever() to lock menu button.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 20 Jan 2012 08:25:11 +0000 (00:25 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 20 Jan 2012 08:26:30 +0000 (00:26 -0800)
MobileCydia.mm

index f789b46fe07e734c6ce29a99054e8f568e30059b..826b316c1b4db60b79777cf975f25ce90c7d2802 100644 (file)
@@ -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"));