From 57df9ddb007559022a00cad01f3003c1a071d2dd Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 28 Mar 2011 14:33:45 +0000 Subject: [PATCH] Fix Cydget Keyboard on 4.x. --- LockScreen.mm | 9 +++++++-- Tweak.mm | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/LockScreen.mm b/LockScreen.mm index 2b6c861..94cb18f 100644 --- a/LockScreen.mm +++ b/LockScreen.mm @@ -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"); diff --git a/Tweak.mm b/Tweak.mm index 0c49064..be0da28 100644 --- 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]; -- 2.45.2