]> git.saurik.com Git - cydget.git/commitdiff
Fix Cydget Keyboard on 4.x.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 28 Mar 2011 14:33:45 +0000 (14:33 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 28 Mar 2011 14:33:45 +0000 (14:33 +0000)
LockScreen.mm
Tweak.mm

index 2b6c8610e99a02b1970551ea79f5a7881c0d8ad6..94cb18f7ed62cb4252eb9c1f4034be3841607691 100644 (file)
@@ -112,7 +112,9 @@ while (false)
 
 static Class $CydgetController(objc_getClass("CydgetController"));
 
-static Class $UIWebBrowserView;
+MSClassHook(UIWebBrowserView)
+MSClassHook(SBAwayView)
+
 static bool Wildcat_, iOS4;
 
 @interface NSString (UIKit)
@@ -237,6 +239,10 @@ static float CYScrollViewDecelerationRateNormal;
 
 @end
 
+MSInstanceMessageHook0(UIView *, SBAwayView, inputView) {
+    return [[[UIView alloc] init] autorelease];
+}
+
 @interface WebCydgetLockScreenView : UIView {
     CydgetWebView *webview_;
     UIScrollView *scroller_;
@@ -857,7 +863,6 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
 
     iOS4 = kCFCoreFoundationVersionNumber >= 550.32;
 
-    $UIWebBrowserView = objc_getClass("UIWebBrowserView");
     if ($UIWebBrowserView == nil) {
         Wildcat_ = false;
         $UIWebBrowserView = objc_getClass("UIWebDocumentView");
index 0c49064a83da3a0211a8f9941a63428f3bbe2a89..be0da285ea129255c2a52f6e2d4f277376c770c3 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -84,10 +84,26 @@ static unsigned online_;
 - (void) disableCydget:(SBAwayController *)away;
 @end
 
+@interface UIPeripheralHost : NSObject
++ (UIPeripheralHost *) sharedInstance;
++ (void) _releaseSharedInstance;
+- (void) createAutomaticKeyboardIfNeeded;
+@end
+
+MSClassHook(UIPeripheralHost)
+
+@interface UITextEffectsWindow : UIWindow
++ (UIWindow *) sharedTextEffectsWindow;
+@end
+
 @implementation NSDictionary (Cydgets)
 
 - (void) enableCydget:(SBAwayController *)away {
     if (NSString *plugin = [self objectForKey:@"CYPlugin"] ?: [self objectForKey:@"Plugin"]) {
+        UIKeyboardEnableAutomaticAppearance();
+        [[$UIPeripheralHost sharedInstance] createAutomaticKeyboardIfNeeded];
+        [[UITextEffectsWindow sharedTextEffectsWindow] setWindowLevel:1000];
+
         [away enableLockScreenBundleWithName:plugin];
         ++online_;
     }
@@ -97,11 +113,18 @@ static unsigned online_;
     if (NSString *plugin = [self objectForKey:@"CYPlugin"] ?: [self objectForKey:@"Plugin"]) {
         --online_;
         [away disableLockScreenBundleWithName:plugin];
+
+        [$UIPeripheralHost _releaseSharedInstance];
+        UIKeyboardDisableAutomaticAppearance();
     }
 }
 
 @end
 
+MSInstanceMessageHook1(void, SpringBoard, handleKeyEvent, GSEventRef, event) {
+    MSSuperCall(event);
+}
+
 MSInstanceMessageHook0(BOOL, SBAwayController, handleMenuButtonTap) {
     if (!MSOldCall() && menu_) {
         [[cydgets_ objectAtIndex:active_] disableCydget:self];