Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 5 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
3  LASimpleListener.x
@@ -510,9 +510,6 @@ static UIWindow *tweetFormerKeyWindow;
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event forListenerName:(NSString *)listenerName
{
- if ([[activator infoDictionaryValueOfKey:@"requires-no-touch-events" forListenerWithName:listenerName] boolValue])
- if (SlideGestureResendEventAfterTouches(event))
- return;
NSString *selector = [activator infoDictionaryValueOfKey:@"selector" forListenerWithName:listenerName];
if (objc_msgSend(self, NSSelectorFromString(selector), activator, event, listenerName))
[event setHandled:YES];
2  Localization
@@ -1 +1 @@
-Subproject commit 1c03208ed7b48271301ea89bc35d616b8e955ee0
+Subproject commit f5b35cdc516d2092f60e96144d20358914cc80b3
View
3  SlideEvents.h
@@ -1,5 +1,2 @@
__attribute__((visibility("hidden")))
void SlideGestureClearAll(void);
-
-__attribute__((visibility("hidden")))
-bool SlideGestureResendEventAfterTouches(LAEvent *event);
View
57 SlideEvents.x
@@ -305,26 +305,53 @@ static inline void SlideGestureClear(id self)
}
}
-static int lastActiveTouchCount;
-static LAEvent *eventToResend;
+static NSInteger lastActiveTouchCount;
+static LAEvent *deferredEvent;
+static NSString *deferredListenerName;
-bool SlideGestureResendEventAfterTouches(LAEvent *event)
+@implementation LASpringBoardActivator (DeferredEvents)
+
+- (NSInteger)_activeTouchCount
{
- if (lastActiveTouchCount) {
- event.handled = YES;
- [eventToResend autorelease];
- eventToResend = [event retain];
- return true;
- }
- return false;
+ return lastActiveTouchCount;
}
+- (void)_deferReceiveEventUntilTouchesComplete:(LAEvent *)event listenerName:(NSString *)listenerName
+{
+ event.handled = YES;
+ [deferredEvent autorelease];
+ deferredEvent = [event retain];
+ [deferredListenerName autorelease];
+ deferredListenerName = [listenerName retain];
+}
+
+- (void)_sendDeferredEvent
+{
+ deferredEvent.handled = NO;
+ [[self listenerForName:deferredListenerName] activator:self receiveEvent:deferredEvent forListenerName:deferredListenerName];
+ [deferredEvent release];
+ deferredEvent = nil;
+ [deferredListenerName release];
+ deferredListenerName = nil;
+}
+
+@end
+
%hook SBHandMotionExtractor
- (void)extractHandMotionForActiveTouches:(void *)activeTouches count:(NSUInteger)count centroid:(CGPoint)centroid
{
dispatch_async(dispatch_get_main_queue(), ^{
- if (count && !lastActiveTouchCount) {
+ NSUInteger newCount = count;
+ if (LASharedActivator.currentEventMode == LAEventModeLockScreen) {
+ // Abort. We use UIGestureRecognizer on the lock screen
+ newCount = 0;
+ SlideGestureClear(self);
+ // Resend events whose listeners don't work when touches are on the screen
+ if (deferredListenerName && deferredEvent) {
+ [LASharedActivator performSelector:@selector(_sendDeferredEvent) withObject:nil afterDelay:0.0];
+ }
+ } else if (count && !lastActiveTouchCount) {
// New gesture
if (![(SBBulletinListController *)[%c(SBBulletinListController) sharedInstance] listViewIsActive]) {
SlideGestureStartWithRotatedLocation(self, centroid);
@@ -345,13 +372,11 @@ bool SlideGestureResendEventAfterTouches(LAEvent *event)
// Finishing gesture
SlideGestureClear(self);
// Resend events whose listeners don't work when touches are on the screen
- if (eventToResend) {
- [LASharedActivator performSelector:@selector(sendEventToListener:) withObject:eventToResend afterDelay:0.0];
- [eventToResend release];
- eventToResend = nil;
+ if (deferredListenerName && deferredEvent) {
+ [LASharedActivator performSelector:@selector(_sendDeferredEvent) withObject:nil afterDelay:0.0];
}
}
- lastActiveTouchCount = count;
+ lastActiveTouchCount = newCount;
});
%orig;
}
View
2  layout/DEBIAN/control
@@ -1,7 +1,7 @@
Package: libactivator
Depends: mobilesubstrate (>= 0.9.3228), preferenceloader (>= 2.0.4), firmware (>= 3.0)
Name: Activator
-Version: 1.6.2~beta4
+Version: 1.6.2~rc1
Priority: optional
Architecture: iphoneos-arm
Description: Centralized gestures, button and shortcut management for iOS
View
3  libactivator-private.h
@@ -34,6 +34,9 @@ extern NSString * const LAEventNameTwoFingerSlideInFromRightBottom;
- (UIImage *)cachedSmallIconForListenerName:(NSString *)listenerName;
+- (NSInteger)_activeTouchCount;
+- (void)_deferReceiveEventUntilTouchesComplete:(LAEvent *)event listenerName:(NSString *)listenerName;
+
@property (nonatomic, readonly) NSURL *moreActionsURL;
@property (nonatomic, readonly) NSURL *adPaneURL;
@property (nonatomic, readonly) NSBundle *bundle;
View
30 libactivator.x
@@ -302,7 +302,12 @@ static UIAlertView *inCydiaAlert;
return;
}
id<LAListener> listener = [self listenerForName:listenerName];
- [listener activator:self receiveEvent:event forListenerName:listenerName];
+ if (self._activeTouchCount && [[listener activator:self requiresInfoDictionaryValueOfKey:@"requires-no-touch-events" forListenerWithName:listenerName] boolValue]) {
+ [self _deferReceiveEventUntilTouchesComplete:event listenerName:listenerName];
+ event.handled = YES;
+ } else {
+ [listener activator:self receiveEvent:event forListenerName:listenerName];
+ }
if ([event isHandled])
for (id<LAListener> otherListener in (NSSet *)_listenerInstances)
if (otherListener != listener)
@@ -463,6 +468,17 @@ static UIAlertView *inCydiaAlert;
LAInvalidSpringBoardOperation();
}
+// Deferred events
+
+- (NSInteger)_activeTouchCount
+{
+ return 0;
+}
+
+- (void)_deferReceiveEventUntilTouchesComplete:(LAEvent *)event listenerName:(NSString *)listenerName
+{
+}
+
// Listeners
- (NSArray *)availableListenerNames
@@ -514,7 +530,10 @@ static UIAlertView *inCydiaAlert;
- (UIImage *)iconForListenerName:(NSString *)listenerName
{
- UIImage *result = [_cachedListenerIcons objectForKey:listenerName];
+ UIImage *result;
+ @synchronized (self) {
+ result = [_cachedListenerIcons objectForKey:listenerName];
+ }
if (!result) {
CGFloat scale = [UIScreen instancesRespondToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f;
id<LAListener> listener = [self listenerForName:listenerName];
@@ -525,8 +544,11 @@ static UIAlertView *inCydiaAlert;
if ([UIImage respondsToSelector:@selector(imageWithCGImage:scale:orientation:)])
result = [UIImage imageWithCGImage:result.CGImage scale:scale orientation:result.imageOrientation];
}
- if (result)
- [_cachedListenerIcons setObject:result forKey:listenerName];
+ if (result) {
+ @synchronized (self) {
+ [_cachedListenerIcons setObject:result forKey:listenerName];
+ }
+ }
}
return result;
}

No commit comments for this range

Something went wrong with that request. Please try again.