#import <ChatKit/CKMessageCell.h>
+#include <sys/sysctl.h>
+
extern "C" void __clear_cache (char *beg, char *end);
@protocol WinterBoard
Class $SBIconLabel;
Class $SBIconList;
Class $SBIconModel;
+Class $SBIconView;
//Class $SBImageCache;
Class $SBSearchView;
Class $SBSearchTableViewCell;
Class $SBUIController;
Class $SBWidgetApplicationIcon;
+#define SBIconView SBIcon
+
static bool IsWild_;
static bool Four_;
MSHook(UIImage *, SBApplicationIcon$generateIconImage$, SBApplicationIcon *self, SEL sel, int type) {
if (type == 2)
if (![Info_ wb$boolForKey:@"ComposeStoreIcons"]) {
- if (IsWild_)
+ if (IsWild_ && false) // XXX: delete this code, it should not be supported
if (NSString *path72 = $pathForIcon$([self application], @"-72"))
return [UIImage imageWithContentsOfFile:path72];
if (NSString *path = $pathForIcon$([self application]))
if (self == nil)
return nil;
- UIDevice *device([UIDevice currentDevice]);
- IsWild_ = [device respondsToSelector:@selector(isWildcat)] && [device isWildcat];
+ {
+ size_t size;
+ sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+ char *machine = new char[size];
+
+ if (sysctlbyname("hw.machine", machine, &size, NULL, 0) == -1) {
+ perror("sysctlbyname(\"hw.machine\", ?)");
+ delete [] machine;
+ machine = NULL;
+ }
+
+ IsWild_ = machine != NULL && strncmp(machine, "iPad", 4) == 0;
+ }
+
+ BOOL (*GSSystemHasCapability)(CFStringRef) = reinterpret_cast<BOOL (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemHasCapability"));
+
+ if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
+ [Info_ setObject:[NSNumber numberWithBool:(
+ !(Papered_ || GSSystemHasCapability != NULL && GSSystemHasCapability(CFSTR("homescreen-wallpaper"))) ||
+ [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
+ [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
+ )] forKey:@"UndockedIconLabels"];
+
+ if (Debug_)
+ NSLog(@"WB:Debug:Info = %@", [Info_ description]);
if (Papered_) {
- UIWindow *&_wallpaperView(MSHookIvar<UIWindow *>(self, "_wallpaperView"));
+ UIImageView *&_wallpaperView(MSHookIvar<UIImageView *>(self, "_wallpaperView"));
if (&_wallpaperView != NULL) {
[_wallpaperView removeFromSuperview];
[_wallpaperView release];
}
}
- UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
UIView *&_contentView(MSHookIvar<UIView *>(self, "_contentView"));
player = &_contentView;
else
player = NULL;
-
UIView *layer(player == NULL ? nil : *player);
- UIView *content([[[UIView alloc] initWithFrame:[layer frame]] autorelease]);
+ UIWindow *window([[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
+ UIView *content([[[UIView alloc] initWithFrame:[window frame]] autorelease]);
+ [window setContentView:content];
+
+ UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
+ [window setBackgroundColor:[_window backgroundColor]];
+ [_window setBackgroundColor:[UIColor clearColor]];
+
+ [window setLevel:-1000];
+ [window setHidden:NO];
/*if (player != NULL)
*player = content;*/
[content setBackgroundColor:[layer backgroundColor]];
[layer setBackgroundColor:[UIColor clearColor]];
- [layer setFrame:[content bounds]];
- [_window setContentView:content];
UIView *indirect;
if (!SummerBoard_ || !IsWild_)
}
}
- [content addSubview:layer];
-
return self;
}
@end
/* }}} */
+MSHook(void, SBIconView$setIconImageAlpha$, SBIconView *self, SEL sel, float alpha) {
+ if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
+ alpha = [number floatValue];
+ return _SBIconView$setIconImageAlpha$(self, sel, alpha);
+}
+
+MSHook(void, SBIconView$setIconLabelAlpha$, SBIconView *self, SEL sel, float alpha) {
+ if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
+ alpha = [number floatValue];
+ return _SBIconView$setIconLabelAlpha$(self, sel, alpha);
+}
+
+MSHook(id, SBIconView$initWithDefaultSize, SBIconView *self, SEL sel) {
+ if ((self = _SBIconView$initWithDefaultSize(self, sel)) != nil) {
+ if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"]) {
+ // XXX: note: this is overridden above, which is silly
+ float alpha([number floatValue]);
+ [self setIconImageAlpha:alpha];
+ [self setIconLabelAlpha:alpha];
+ }
+ } return self;
+}
+
MSHook(void, SBIcon$setAlpha$, SBIcon *self, SEL sel, float alpha) {
if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
alpha = [number floatValue];
MSHook(UIImage *, _UIImageWithName, NSString *name) {
if (Debug_)
NSLog(@"WB:Debug: _UIImageWithName(\"%@\")", name);
+ if (name == nil)
+ return nil;
int identifier;
bool packed;
$WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
+ bool olden(dlsym(RTLD_DEFAULT, "GSLibraryCopyGenerationInfoValueForKey") == NULL);
+
+ if (olden)
+ $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
+
$SBApplication = objc_getClass("SBApplication");
$SBApplicationIcon = objc_getClass("SBApplicationIcon");
$SBAwayView = objc_getClass("SBAwayView");
$SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
$SBButtonBar = objc_getClass("SBButtonBar");
- $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
$SBDockIconListView = objc_getClass("SBDockIconListView");
$SBIcon = objc_getClass("SBIcon");
$SBIconBadge = objc_getClass("SBIconBadge");
$SBIconLabel = objc_getClass("SBIconLabel");
$SBIconList = objc_getClass("SBIconList");
$SBIconModel = objc_getClass("SBIconModel");
+ $SBIconView = objc_getClass("SBIconView");
//$SBImageCache = objc_getClass("SBImageCache");
$SBSearchView = objc_getClass("SBSearchView");
$SBSearchTableViewCell = objc_getClass("SBSearchTableViewCell");
$SBUIController = objc_getClass("SBUIController");
$SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
+ if ($SBIconView == nil)
+ $SBIconView = $SBIcon;
+
Four_ = $SBDockIconListView != nil;
WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
WBRename(SBIcon, setAlpha:, setAlpha$);
WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
+ WBRename(SBIconView, initWithDefaultSize, initWithDefaultSize);
+ WBRename(SBIconView, setIconImageAlpha:, setIconImageAlpha$);
+ WBRename(SBIconView, setIconLabelAlpha:, setIconLabelAlpha$);
WBRename(SBUIController, init, init);
WBRename(SBWidgetApplicationIcon, icon, icon);
WBRename(SBDockIconListView, setFrame:, setFrame$);
MSHookMessage(object_getClass($SBDockIconListView), @selector(shouldShowNewDock), &$SBDockIconListView$shouldShowNewDock, &_SBDockIconListView$shouldShowNewDock);
- WBRename(SBIconLabel, drawRect:, drawRect$);
+ if (olden)
+ WBRename(SBIconLabel, drawRect:, drawRect$);
+
WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
WBRename(SBIconLabel, setInDock:, setInDock$);
Docked_ = $getTheme$([NSArray arrayWithObjects:@"Dock.png", nil]);
- if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
- [Info_ setObject:[NSNumber numberWithBool:(
- !Papered_ ||
- [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
- [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
- )] forKey:@"UndockedIconLabels"];
-
- if (Debug_)
- NSLog(@"WB:Debug:Info = %@", [Info_ description]);
-
[pool release];
}