]> git.saurik.com Git - cydia.git/commitdiff
Fix background color so it works on all iOS builds.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 24 Dec 2013 00:18:02 +0000 (16:18 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 24 Dec 2013 00:18:02 +0000 (16:18 -0800)
CyteKit/ViewController.h
CyteKit/ViewController.mm
CyteKit/WebViewController.h
CyteKit/WebViewController.mm

index e3712688064e89ab66ff3f0af158b1decf997bee..b1372491d9caaaccf9e3e82ffc216c39fea1013c 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <UIKit/UIKit.h>
 
+#include <Menes/ObjectHandle.h>
+
 @interface UIViewController (Cydia)
 - (BOOL) hasLoaded;
 - (void) reloadData;
@@ -36,6 +38,7 @@
 @interface CyteViewController : UIViewController {
     _transient id delegate_;
     BOOL loaded_;
+    _H<UIColor> color_;
 }
 
 // The default implementation of this method is essentially a no-op,
@@ -62,6 +65,8 @@
 // just happens not to be visible.
 - (void) releaseSubviews;
 
+- (void) setPageColor:(UIColor *)color;
+
 @end
 
 #endif//CyteKit_ViewController_H
index a036595603c7e4f7af99b2e2d2c97ee469f968a9..df2ba616573d4568de456c5f97e6c9898d243520 100644 (file)
@@ -24,6 +24,8 @@
 #include <Foundation/Foundation.h>
 #include <UIKit/UIKit.h>
 
+#include "iPhonePrivate.h"
+
 extern bool IsWildcat_;
 
 @implementation UIViewController (Cydia)
@@ -110,4 +112,13 @@ extern bool IsWildcat_;
     return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
 }
 
+- (void) setPageColor:(UIColor *)color {
+    if (color == nil) {
+        color = [UIColor groupTableViewBackgroundColor];
+        if ([color isEqual:[UIColor clearColor]])
+            color = [UIColor pinStripeColor];
+            //color = [UIColor colorWithRed:(215.0/255.0) green:(217.0/255.0) blue:(223.0/255.0) alpha:1.0];
+    } color_ = color;
+}
+
 @end
index c8d9d5123ce829eb325daa90be0a22ee63551a25..cb1bf610bfa5e3374d756f22366225edee3e8e71 100644 (file)
@@ -71,7 +71,6 @@
 
     float width_;
     Class class_;
-    _H<UIColor> color_;
 
     _H<UIBarButtonItem> reloaditem_;
     _H<UIBarButtonItem> loadingitem_;
 - (id) initWithWidth:(float)width;
 - (id) initWithWidth:(float)width ofClass:(Class)_class;
 
-- (void) setColor:(UIColor *)color;
-
 - (void) callFunction:(WebScriptObject *)function;
 
 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
index f5ec06094f7546edc81ed5a2924239c4b88402ae..c4931cbeaab6368501ceab44aeebb4e154ba2e31 100644 (file)
@@ -418,12 +418,12 @@ float CYScrollViewDecelerationRateNormal;
 
     if (page == nil) {
         CyteWebViewController *browser([[[class_ alloc] init] autorelease]);
-        [browser setColor:color_];
         [browser setRequest:request];
         page = browser;
     }
 
     [page setDelegate:delegate_];
+    [page setPageColor:color_];
 
     if (!pop) {
         [[self navigationItem] setTitle:title_];
@@ -579,20 +579,18 @@ float CYScrollViewDecelerationRateNormal;
                             float blue([[rgb blue] getFloatValue:DOM_CSS_NUMBER]);
                             float alpha([[rgb alpha] getFloatValue:DOM_CSS_NUMBER]);
 
-                            uic = [UIColor
-                                colorWithRed:(red / 255)
-                                green:(green / 255)
-                                blue:(blue / 255)
-                                alpha:alpha
-                            ];
+                            if (alpha == 1)
+                                uic = [UIColor
+                                    colorWithRed:(red / 255)
+                                    green:(green / 255)
+                                    blue:(blue / 255)
+                                    alpha:alpha
+                                ];
                         }
                     }
 
-                    if (uic == nil)
-                        uic = [UIColor groupTableViewBackgroundColor];
-
-                    color_ = uic;
-                    [scroller_ setBackgroundColor:uic];
+                    [self setPageColor:uic];
+                    [scroller_ setBackgroundColor:color_];
                     break;
                 }
     }
@@ -838,7 +836,7 @@ float CYScrollViewDecelerationRateNormal;
         width_ = width;
         class_ = _class;
 
-        color_ = [UIColor groupTableViewBackgroundColor];
+        [self setPageColor:nil];
 
         allowsNavigationAction_ = true;
 
@@ -956,6 +954,9 @@ float CYScrollViewDecelerationRateNormal;
         //[scroller setAllowsRubberBanding:YES];
     }
 
+    [webview_ setOpaque:NO];
+    [webview_ setBackgroundColor:color_];
+
     [scroller_ setFixedBackgroundPattern:YES];
     [scroller_ setBackgroundColor:color_];
     [scroller_ setClipsSubviews:YES];
@@ -1000,10 +1001,6 @@ float CYScrollViewDecelerationRateNormal;
     } return self;
 }
 
-- (void) setColor:(UIColor *)color {
-    color_ = color;
-}
-
 - (void) callFunction:(WebScriptObject *)function {
     WebThreadLocked lock;