From 0039464fd15dc3a1e9c04e06df4c6faa84fa85d2 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 24 Apr 2008 23:58:39 +0000 Subject: [PATCH] Fixed keyboard click sound thingees. --- Cydia.mm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Cydia.mm b/Cydia.mm index 789d5035..524ec1fc 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -424,6 +424,9 @@ static CGColor Clear_; static CGColor Red_; static CGColor White_; +static NSString *Home_; +static BOOL Sounds_Keyboard_; + const char *Firmware_ = NULL; const char *Machine_ = NULL; const char *SerialNumber_ = NULL; @@ -4243,6 +4246,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString CGSize keysize = [UIKeyboard defaultSize]; CGRect keyrect = {{0, [overlay_ bounds].size.height - keysize.height}, keysize}; keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect]; + [[UIKeyboardImpl sharedInstance] setSoundsEnabled:(Sounds_Keyboard_ ? YES : NO)]; [self reloadData]; [book_ update]; @@ -4324,8 +4328,19 @@ id Dealloc_(id self, SEL selector) { }*/ int main(int argc, char *argv[]) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + bootstrap_ = argc > 1 && strcmp(argv[1], "--bootstrap") == 0; + Home_ = NSHomeDirectory(); + + { + NSString *plist = [Home_ stringByAppendingString:@"/Library/Preferences/com.apple.preferences.sounds.plist"]; + if (NSDictionary *sounds = [NSDictionary dictionaryWithContentsOfFile:plist]) + if (NSNumber *keyboard = [sounds objectForKey:@"keyboard"]) + Sounds_Keyboard_ = [keyboard boolValue]; + } + setuid(0); setgid(0); @@ -4337,8 +4352,6 @@ int main(int argc, char *argv[]) { dealloc_ = dealloc->method_imp; dealloc->method_imp = (IMP) &Dealloc_;*/ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (NSDictionary *sysver = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) { if (NSString *prover = [sysver valueForKey:@"ProductVersion"]) { Firmware_ = strdup([prover UTF8String]); -- 2.45.2