]> git.saurik.com Git - cydia.git/commitdiff
Downgrade support for -[UIScrollView setDecelerationRate].
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 5 Nov 2010 16:32:48 +0000 (09:32 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 5 Nov 2010 16:32:48 +0000 (09:32 -0700)
UICaboodle/BrowserView.mm
iPhonePrivate.h

index 8b361f5ecaa680641992e8874a687f9572241ab4..90a584f34a23020e30d81cebfa829e3cb8077501 100644 (file)
@@ -36,6 +36,8 @@ static inline void CYRelease(Type_ &value) {
     }
 }
 
+float CYScrollViewDecelerationRateNormal;
+
 @interface WebView (Apple)
 - (void) _setLayoutInterval:(float)interval;
 @end
@@ -315,6 +317,11 @@ enum CYWebPolicyDecision {
 
 + (void) _initialize {
     [WebPreferences _setInitialDefaultTextEncodingToSystemEncoding];
+
+    if (float *_UIScrollViewDecelerationRateNormal = reinterpret_cast<float *>(dlsym(RTLD_DEFAULT, "UIScrollViewDecelerationRateNormal")))
+        CYScrollViewDecelerationRateNormal = *_UIScrollViewDecelerationRateNormal;
+    else // XXX: this actually might be fast on some older systems: we should look into this
+        CYScrollViewDecelerationRateNormal = 0.998;
 }
 
 - (void) dealloc {
@@ -807,7 +814,7 @@ enum CYWebPolicyDecision {
             scroller_ = [webview_ _scrollView];
 
             [scroller_ setDirectionalLockEnabled:YES];
-            [scroller_ setDecelerationRate:UIScrollViewDecelerationRateNormal];
+            [scroller_ setDecelerationRate:CYScrollViewDecelerationRateNormal];
             [scroller_ setDelaysContentTouches:NO];
 
             [scroller_ setCanCancelContentTouches:YES];
@@ -816,7 +823,8 @@ enum CYWebPolicyDecision {
             scroller_ = (UIScrollView *) scroller;
 
             [scroller setDirectionalScrolling:YES];
-            [scroller setScrollDecelerationFactor:UIScrollViewDecelerationRateNormal]; /* 0.989324 */
+            // XXX: we might be better off /not/ setting this on older systems
+            [scroller setScrollDecelerationFactor:CYScrollViewDecelerationRateNormal]; /* 0.989324 */
             [scroller setScrollHysteresis:0]; /* 8 */
 
             [scroller setThumbDetectionEnabled:NO];
index 6dc893b7ebcf306f156f5501253e006a7996c85d..1c1985812b4bf4bc74cf7c68ad4584b1f79a9a39 100644 (file)
@@ -318,6 +318,12 @@ typedef enum {
 - (void) setModalPresentationStyle:(UIModalPresentationStyle)style;
 @end
 
+@interface UIScrollView (iOS_3_0)
+@property(assign, nonatomic) float decelerationRate;
+@end
+
+extern float const UIScrollViewDecelerationRateNormal;
+
 #endif//AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
 // }}}