]> git.saurik.com Git - veency.git/commitdiff
Add support for i4 high-res.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 30 Aug 2010 21:51:34 +0000 (21:51 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 30 Aug 2010 21:51:34 +0000 (21:51 +0000)
Tweak.mm
makefile

index 18ad95db09d6be58b24216ace2b3db9225f52d15..959e12bb1ea967766934534f7fb6a11bf13cab70 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -42,7 +42,7 @@
 #define _unlikely(expr) \
     __builtin_expect(expr, 0)
 
-#include <substrate.h>
+#include <CydiaSubstrate.h>
 
 #include <rfb/rfb.h>
 #include <rfb/keysym.h>
@@ -68,6 +68,7 @@ extern "C" void CoreSurfaceBufferFlushProcessorCaches(CoreSurfaceBufferRef buffe
 
 static size_t width_;
 static size_t height_;
+static NSUInteger ratio_ = 0;
 
 static const size_t BytesPerPixel = 4;
 static const size_t BitsPerSample = 8;
@@ -172,6 +173,15 @@ static void VNCEnabled();
 }
 
 + (void) registerClient {
+    // XXX: this could find a better home
+    if (ratio_ == 0) {
+        UIScreen *screen([UIScreen mainScreen]);
+        if ([screen respondsToSelector:@selector(scale)])
+            ratio_ = [screen scale];
+        else
+            ratio_ = 1;
+    }
+
     ++clients_;
     AshikaseSetEnabled(true, false);
     [[$SBStatusBarController sharedStatusBarController] addStatusBarItem:@"Veency"];
@@ -283,11 +293,16 @@ static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size) {
 }
 
 static void VNCPointer(int buttons, int x, int y, rfbClientPtr client) {
+    if (ratio_ == 0)
+        return;
+    x /= ratio_;
+    y /= ratio_;
+
     CGPoint location = {x, y};
 
     if (width_ > height_) {
         int t(x);
-        x = height_ - 1 - y;
+        x = height_ / ratio_ - 1 - y;
         y = t;
     }
 
index 03f593a8e94c28182acff2c67609380b89d3ca27..2c71f5ae17a35efa6b53c8ddf3e1029f12eeffc7 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,6 +1,6 @@
 name := Veency
 id := vncs
-flags := -lvncserver -framework IOMobileFramebuffer -framework CoreSurface -framework IOKit -framework GraphicsServices -I/apl/inc/iPhoneOS-2.0 -framework QuartzCore -weak_reference_mismatches weak
+flags := -lvncserver -framework IOMobileFramebuffer -framework CoreSurface -framework IOKit -framework GraphicsServices -I/apl/inc/iPhoneOS-2.0 -framework QuartzCore -weak_reference_mismatches weak -framework UIKit
 base := ../tweaks
 include ../tweaks/tweak.mk