From 664454595a92e06d476d13804ee03d0dc1cd7621 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 7 May 2014 16:50:01 -0700 Subject: [PATCH] Support iOS 7.0. --- FiveIconDock.mm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/FiveIconDock.mm b/FiveIconDock.mm index 2bce488..e36254d 100644 --- a/FiveIconDock.mm +++ b/FiveIconDock.mm @@ -56,7 +56,7 @@ MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) { return 5; } -MSClassMessageHook1(int, SBDockIconListView, iconColumnsForInterfaceOrientation, int, orientation) { +MSClassMessageHook1(NSUInteger, SBDockIconListView, iconColumnsForInterfaceOrientation, NSInteger, orientation) { return 5; } @@ -129,9 +129,22 @@ MSInstanceMessageHook2(CGPoint, SBDockIconListView, originForIconAtX,Y, int, x, return origin; } -/*MSClassMessageHook0(int, SBIconModel, maxIconListCount) { - return 16; -}*/ +// XXX: merge with previous functions if possible, but not until after iPhone 5S ;P +MSInstanceMessage1(CGPoint, SBDockIconListView, originForIconAtIndex, NSInteger, index) { + CGPoint origin(MSOldCall(0)); + + unsigned count([[self icons] count]), gap; + unsigned space(320 - 60 * count); + + if (count >= 4) + gap = space / (count + 1); + else // I hate people who love Apple. + gap = 16; + + origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * index; + + return origin; +} MSInitialize { NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); @@ -140,5 +153,8 @@ MSInitialize { if (Class $ISIconSupport = objc_getClass("ISIconSupport")) [[$ISIconSupport sharedInstance] addExtension:@"com.saurik.iphone.fid"]; + if (kCFCoreFoundationVersionNumber >= 800) + MSHookMessage($SBDockIconListView, @selector(originForIconAtIndex:), MSHake(SBDockIconListView$originForIconAtIndex$)); + [pool release]; } -- 2.45.2