From 4f651400990874d88ab8be0403e371f88e36b954 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 13 Mar 2011 14:29:45 -0700 Subject: [PATCH] Add dispatchEvent:@"CydiaTouchEnd". --- CyteKit/dispatchEvent.mm | 17 +++++++++++++++++ iPhonePrivate.h | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/CyteKit/dispatchEvent.mm b/CyteKit/dispatchEvent.mm index 277d89b2..f0e79add 100644 --- a/CyteKit/dispatchEvent.mm +++ b/CyteKit/dispatchEvent.mm @@ -74,3 +74,20 @@ } @end + +MSHook(void, UIWebBrowserView$_webTouchEventsRecognized$, UIWebBrowserView *self, SEL _cmd, UIWebTouchEventsGestureRecognizer *recognizer) { + _UIWebBrowserView$_webTouchEventsRecognized$(self, _cmd, recognizer); + + if ([recognizer type] == 8) + //if ([[recognizer _typeDescription] isEqualToString:@"WebEventTouchEnd"]) + [self dispatchEvent:@"CydiaTouchEnd"]; +} + +__attribute__((__constructor__)) static void $() { + if (Class $UIWebBrowserView = objc_getClass("UIWebBrowserView")) { + if (Method method = class_getInstanceMethod($UIWebBrowserView, @selector(_webTouchEventsRecognized:))) { + _UIWebBrowserView$_webTouchEventsRecognized$ = reinterpret_cast(method_getImplementation(method)); + method_setImplementation(method, reinterpret_cast(&$UIWebBrowserView$_webTouchEventsRecognized$)); + } + } +} diff --git a/iPhonePrivate.h b/iPhonePrivate.h index e9df9180..b5a59594 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -149,6 +149,15 @@ typedef enum { + (WebDefaultUIKitDelegate *) sharedUIKitDelegate; @end // }}} +// @interface UIWeb* : * {{{ +@interface UIWebBrowserView : UIWebDocumentView +@end + +@interface UIWebTouchEventsGestureRecognizer : UIGestureRecognizer +- (int) type; +- (NSString *) _typeDescription; +@end +// }}} // @interface NS* (*) {{{ @interface NSMutableURLRequest (Apple) -- 2.50.0