Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Proper merge of theos-refactor

  • Loading branch information...
commit cb7e67ed114273486a66dbb341acaa91babaa948 2 parents 6553849 + c3989ad
Ryan Petrich authored
6 PSWApplication.h
View
@@ -54,9 +54,9 @@ typedef enum {
@property (nonatomic, readonly) PSWCropInsets snapshotCropInsets;
@property (nonatomic, readonly) PSWSnapshotRotation snapshotRotation;
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface;
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets;
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets rotation:(PSWSnapshotRotation)rotation;
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface;
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets;
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets rotation:(PSWSnapshotRotation)rotation;
#endif
- (BOOL)writeSnapshotToDisk;
- (void)exit;
14 PSWApplication.xm
View
@@ -108,7 +108,7 @@ static NSUInteger defaultImagePassThrough;
}
#ifdef USE_IOSURFACE
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets rotation:(PSWSnapshotRotation)rotation
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets rotation:(PSWSnapshotRotation)rotation
{
if (surface != _surface) {
CGImageRelease(_snapshotImage);
@@ -128,29 +128,29 @@ static NSUInteger defaultImagePassThrough;
_cropInsets.right = 0;
if (surface) {
- CFRetain(surface);
- _surface = surface;
+ _surface = PSWSurfaceCopyToMainMemory(surface, 'L565', 2);
_cropInsets = cropInsets;
_snapshotRotation = rotation;
}
if ([_delegate respondsToSelector:@selector(applicationSnapshotDidChange:)])
[_delegate applicationSnapshotDidChange:self];
}
+ return _surface;
}
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface cropInsets:(PSWCropInsets)cropInsets
{
- [self loadSnapshotFromSurface:surface cropInsets:cropInsets rotation:PSWSnapshotRotationNone];
+ return [self loadSnapshotFromSurface:surface cropInsets:cropInsets rotation:PSWSnapshotRotationNone];
}
-- (void)loadSnapshotFromSurface:(IOSurfaceRef)surface
+- (IOSurfaceRef)loadSnapshotFromSurface:(IOSurfaceRef)surface
{
PSWCropInsets insets;
insets.top = 0;
insets.left = 0;
insets.bottom = 0;
insets.right = 0;
- [self loadSnapshotFromSurface:surface cropInsets:insets rotation:PSWSnapshotRotationNone];
+ return [self loadSnapshotFromSurface:surface cropInsets:insets rotation:PSWSnapshotRotationNone];
}
#endif
101 PSWApplicationController.xm
View
@@ -1,6 +1,5 @@
#import "PSWApplicationController.h"
-#import <CaptainHook/CaptainHook.h>
#import <SpringBoard/SpringBoard.h>
#import "PSWApplication.h"
@@ -121,6 +120,7 @@ static SBApplication *currentZoomApp;
static UIWindow *currentZoomStatusWindow;
%hook SBUIController
+
- (void)showZoomLayerWithIOSurfaceSnapshotOfApp:(SBApplication *)application includeStatusWindow:(UIWindow *)statusWindow
{
currentZoomApp = application;
@@ -129,6 +129,7 @@ static UIWindow *currentZoomStatusWindow;
currentZoomStatusWindow = nil;
currentZoomApp = nil;
}
+
%end
%hook SBZoomView
@@ -136,71 +137,57 @@ static UIWindow *currentZoomStatusWindow;
// 3.0-3.1
- (id)initWithSnapshotFrame:(CGRect)snapshotFrame ioSurface:(IOSurfaceRef)surface
{
- surface = PSWSurfaceCopyToMainMemory(surface, 'L565', 2);
- if ((self = %orig)) {
- PSWApplication *application = [[PSWApplicationController sharedInstance] applicationWithDisplayIdentifier:[currentZoomApp displayIdentifier]];
- PSWCropInsets insets;
- insets.top = 0;
- insets.left = 0;
- insets.bottom = 0;
- insets.right = 0;
- if (currentZoomStatusWindow) {
- CGRect frame = [currentZoomStatusWindow frame];
- CGSize screenSize = [[UIScreen mainScreen] bounds].size;
- if (frame.origin.y + frame.size.height < screenSize.height / 2.0f)
- insets.top = frame.size.height;
- else if (frame.origin.x + frame.size.width < screenSize.width / 2.0f)
- insets.left = frame.size.width;
- else if (frame.size.width > frame.size.height)
- insets.bottom = frame.size.height;
- else
- insets.right = frame.size.width;
- }
- [application loadSnapshotFromSurface:surface cropInsets:insets];
+ PSWApplication *application = [[PSWApplicationController sharedInstance] applicationWithDisplayIdentifier:[currentZoomApp displayIdentifier]];
+ PSWCropInsets insets;
+ insets.top = 0;
+ insets.left = 0;
+ insets.bottom = 0;
+ insets.right = 0;
+ if (currentZoomStatusWindow) {
+ CGRect frame = [currentZoomStatusWindow frame];
+ CGSize screenSize = [[UIScreen mainScreen] bounds].size;
+ if (frame.origin.y + frame.size.height < screenSize.height / 2.0f)
+ insets.top = frame.size.height;
+ else if (frame.origin.x + frame.size.width < screenSize.width / 2.0f)
+ insets.left = frame.size.width;
+ else if (frame.size.width > frame.size.height)
+ insets.bottom = frame.size.height;
+ else
+ insets.right = frame.size.width;
}
- if (surface)
- CFRelease(surface);
- return self;
+ surface = [application loadSnapshotFromSurface:surface cropInsets:insets];
+ return %orig;
}
// 3.2
- (id)initWithSnapshotFrame:(CGRect)snapshotFrame ioSurface:(IOSurfaceRef)surface transform:(CGAffineTransform)transform
{
- surface = PSWSurfaceCopyToMainMemory(surface, 'L565', 2);
- if ((self = %orig)) {
- PSWApplication *application = [[PSWApplicationController sharedInstance] applicationWithDisplayIdentifier:[currentZoomApp displayIdentifier]];
- PSWCropInsets insets;
- insets.top = 0;
- insets.left = 0;
- insets.bottom = 0;
- insets.right = 0;
- PSWSnapshotRotation rotation;
- switch (MSHookIvar<UIInterfaceOrientation>([$SBUIController sharedInstance], "_orientation")) {
- case UIInterfaceOrientationPortrait:
- rotation = PSWSnapshotRotation90Left;
- break;
- case UIInterfaceOrientationPortraitUpsideDown:
- rotation = PSWSnapshotRotation90Right;
- break;
- case UIInterfaceOrientationLandscapeLeft:
- rotation = PSWSnapshotRotation180;
- break;
- case UIInterfaceOrientationLandscapeRight:
- default:
- rotation = PSWSnapshotRotationNone;
- break;
- }
- [application loadSnapshotFromSurface:surface cropInsets:insets rotation:rotation];
+ PSWApplication *application = [[PSWApplicationController sharedInstance] applicationWithDisplayIdentifier:[currentZoomApp displayIdentifier]];
+ PSWCropInsets insets;
+ insets.top = 0;
+ insets.left = 0;
+ insets.bottom = 0;
+ insets.right = 0;
+ PSWSnapshotRotation rotation;
+ switch (MSHookIvar<UIInterfaceOrientation>([$SBUIController sharedInstance], "_orientation")) {
+ case UIInterfaceOrientationPortrait:
+ rotation = PSWSnapshotRotation90Left;
+ break;
+ case UIInterfaceOrientationPortraitUpsideDown:
+ rotation = PSWSnapshotRotation90Right;
+ break;
+ case UIInterfaceOrientationLandscapeLeft:
+ rotation = PSWSnapshotRotation180;
+ break;
+ case UIInterfaceOrientationLandscapeRight:
+ default:
+ rotation = PSWSnapshotRotationNone;
+ break;
}
- if (surface)
- CFRelease(surface);
- return self;
+ surface = [application loadSnapshotFromSurface:surface cropInsets:insets rotation:rotation];
+ return %orig;
}
%end
#endif
-
-
-
-
25 PSWContainerView.xm
View
@@ -85,7 +85,7 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
- (void)shouldExit
{
- [self.pageView shouldExit];
+ [_pageView shouldExit];
}
- (void)_applyInsets
@@ -157,19 +157,19 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
- (void)setPageControlCount:(NSInteger)count
{
- [self.pageControl setNumberOfPages:count];
+ [_pageControl setNumberOfPages:count];
[self setIsEmpty:!count];
}
- (NSInteger)pageControlPage
{
- return [self.pageControl currentPage];
+ return [_pageControl currentPage];
}
- (void)setPageControlPage:(NSInteger)page
{
- [self.pageControl setCurrentPage:page];
+ [_pageControl setCurrentPage:page];
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
@@ -182,13 +182,13 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
- (void)tapPreviousAndContinue
{
- [self.pageView movePrevious];
+ [_pageView movePrevious];
_shouldScrollOnUp = NO;
}
- (void)tapNextAndContinue
{
- [self.pageView moveNext];
+ [_pageView moveNext];
_shouldScrollOnUp = NO;
}
@@ -196,13 +196,13 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
- CGPoint offset = [self.pageView frame].origin;
+ CGPoint offset = [_pageView frame].origin;
point.x -= offset.x;
if (point.x <= 0.0f) {
[self performSelector:@selector(tapPreviousAndContinue) withObject:nil afterDelay:0.1f];
- } else if (point.x > [self.pageView bounds].size.width) {
+ } else if (point.x > [_pageView bounds].size.width) {
[self performSelector:@selector(tapNextAndContinue) withObject:nil afterDelay:0.1f];
}
@@ -225,7 +225,7 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
UITouch *touch = [touches anyObject];
NSInteger tapCount = [touch tapCount];
CGPoint point = [touch locationInView:self];
- CGPoint offset = [self.pageView frame].origin;
+ CGPoint offset = [_pageView frame].origin;
point.x -= offset.x;
@@ -234,14 +234,14 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
_doubleTapped = YES;
if (point.x <= 0.0f) {
- [self.pageView moveToStart];
+ [_pageView moveToStart];
} else {
- [self.pageView moveToEnd];
+ [_pageView moveToEnd];
}
} else if (_shouldScrollOnUp) {
if (point.x <= 0.0f) {
[self tapPreviousAndContinue];
- } else if (point.x > [self.pageView bounds].size.width) {
+ } else if (point.x > [_pageView bounds].size.width) {
[self tapNextAndContinue];
}
}
@@ -258,4 +258,3 @@ CGRect PSWProportionalInsetsInsetRect(CGRect rect, PSWProportionalInsets insets)
}
@end
-
40 PSWController.xm
View
@@ -116,9 +116,8 @@ static PSWController *sharedController;
[containerView setPageView:snapshotPageView];
[snapshotPageView setPageViewDelegate:self];
-
[containerView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
-
+
LAActivator *la = [$LAActivator sharedInstance];
if ([la respondsToSelector:@selector(hasSeenListenerWithName:)] && [la respondsToSelector:@selector(assignEvent:toListenerWithName:)])
if (![la hasSeenListenerWithName:@"com.collab.proswitcher"])
@@ -276,7 +275,8 @@ static PSWController *sharedController;
- (void)didFinishActivate
{
isAnimating = NO;
- [snapshotPageView layoutSubviews];
+ [containerView layoutSubviews];
+ [containerView setTransform:CGAffineTransformIdentity];
}
- (void)activateWithAnimation:(BOOL)animated
@@ -318,10 +318,10 @@ static PSWController *sharedController;
if (animated) {
[containerView setAlpha:0.0f];
- [snapshotPageView.layer setTransform:CATransform3DMakeScale(2.0f, 2.0f, 1.0f)];
+ [containerView setTransform:CGAffineTransformMakeScale(2.0f, 2.0f)];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5f];
- [snapshotPageView.layer setTransform:CATransform3DIdentity];
+ [containerView setTransform:CGAffineTransformIdentity];
}
if (GetPreference(PSWShowPageControl, BOOL))
@@ -346,7 +346,7 @@ static PSWController *sharedController;
{
[containerView removeFromSuperview];
[containerView setHidden:YES];
- [snapshotPageView.layer setTransform:CATransform3DIdentity];
+ [containerView setTransform:CGAffineTransformIdentity];
isAnimating = NO;
}
@@ -362,10 +362,10 @@ static PSWController *sharedController;
focusedApplication = [[snapshotPageView focusedApplication] retain];
if (animated) {
- [snapshotPageView.layer setTransform:CATransform3DIdentity];
+ [containerView setTransform:CGAffineTransformIdentity];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5f];
- [snapshotPageView.layer setTransform:CATransform3DMakeScale(2.0f, 2.0f, 1.0f)];
+ [containerView setTransform:CGAffineTransformMakeScale(2.0f, 2.0f)];
}
// Show SpringBoard's page control
@@ -504,6 +504,27 @@ static PSWController *sharedController;
@end
+@interface PSWController (Beta) <UIAlertViewDelegate>
+- (void)showBetaAlert;
+@end
+
+@implementation PSWController (Beta)
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+ if (buttonIndex != [alertView cancelButtonIndex])
+ [SBSharedInstance applicationOpenURL:[NSURL URLWithString:@"http://github.com/rpetrich/ProSwitcher/issues"]];
+}
+
+- (void)showBetaAlert
+{
+ UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"ProSwitcher Alpha" message:@"\"If debugging is the process of removing software bugs, then programming must be the process of putting them in.\" -- Edsger Dijkstra\n\nPlease help us get the bugs out :)" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:@"Report Bug", nil];
+ [av show];
+ [av release];
+}
+
+@end
+
#pragma mark Preference Changed Notification
static void PreferenceChangedCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
@@ -565,10 +586,11 @@ static void PreferenceChangedCallback(CFNotificationCenterRef center, void *obse
PSWWriteBinaryPropertyList(plistDict, PSWPreferencesFilePath);
}
[plistDict release];
-
+
%orig;
sharedController = [[PSWController alloc] init];
+ [sharedController showBetaAlert];
if (GetPreference(PSWBecomeHomeScreen, NSInteger) != PSWBecomeHomeScreenDisabled)
[sharedController setActive:YES animated:NO];
15 PSWResources.h
View
@@ -17,13 +17,14 @@ NSString *PSWLocalize(NSString *text);
typedef enum {
PSWHardwareTypeUnknown,
- PSWHardwareTypeiPhoneOriginal,
- PSWHardwareTypeiPodTouch1G,
- PSWHardwareTypeiPhone3G,
- PSWHardwareTypeiPodTouch2G,
- PSWHardwareTypeiPhone3GS,
- PSWHardwareTypeiPodTouch3G,
- PSWHardwareTypeiPad1G,
+ PSWHardwareTypeiPhoneOriginal,
+ PSWHardwareTypeiPodTouch1G,
+ PSWHardwareTypeiPhone3G,
+ PSWHardwareTypeiPodTouch2G,
+ PSWHardwareTypeiPhone3GS,
+ PSWHardwareTypeiPodTouch3G,
+ PSWHardwareTypeiPad1G,
} PSWHardwareType;
// For convenience: newer models > older models
+
PSWHardwareType PSWGetHardwareType();
1  PSWResources.xm
View
@@ -1,7 +1,6 @@
#import "PSWResources.h"
#import <CoreGraphics/CoreGraphics.h>
-#import <CaptainHook/CaptainHook.h>
#include <sys/types.h>
#include <sys/sysctl.h>
2  PSWSurface.xm
View
@@ -39,7 +39,7 @@ IOSurfaceRef PSWSurfaceCopyToMainMemory(IOSurfaceRef surface, OSType pixelFormat
// Transfer
IOSurfaceAcceleratorTransferSurface(accelerator, surface, newSurface, NULL, NULL);
// Flush processor caches
- // IOSurfaceFlushProcessorCaches(newSurface);
+ IOSurfaceFlushProcessorCaches(newSurface);
return newSurface;
}
#endif
2  framework
@@ -1 +1 @@
-Subproject commit 01cf7019fb174504b92d6f4a2bfc05933d05c235
+Subproject commit ba02d93e151fa28e55a6e31aa47323daf0b6ea94
4 layout/DEBIAN/control
View
@@ -1,10 +1,10 @@
Package: com.collab.proswitcher
-Depends: mobilesubstrate, preferenceloader (>= 1.1), libactivator (>= 1.1.0), backgrounder
+Depends: mobilesubstrate (>= 0.9.3087), preferenceloader (>= 2.0.2), libactivator (>= 1.4.2), backgrounder (>= svn.r461)
Provides: proswitcher
Conflicts: com.aaronash.Multifl0w, com.beyoip.proswitcherita
Replaces: com.aaronash.Multifl0w, com.beyoip.proswitcherita
Name: ProSwitcher
-Version: 1.5
+Version: 1.5~alpha
Priority: optional
Architecture: iphoneos-arm
Description: Free visual multitasking switcher.
Please sign in to comment.
Something went wrong with that request. Please try again.