From: Jay Freeman (saurik) Date: Mon, 30 Aug 2010 21:51:34 +0000 (+0000) Subject: Add support for i4 high-res. X-Git-Tag: v0.9.3345~1 X-Git-Url: https://git.saurik.com/veency.git/commitdiff_plain/0c4503df4badd6711ac49f74e8f9f9f169f16212 Add support for i4 high-res. --- diff --git a/Tweak.mm b/Tweak.mm index 18ad95d..959e12b 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -42,7 +42,7 @@ #define _unlikely(expr) \ __builtin_expect(expr, 0) -#include +#include #include #include @@ -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; } diff --git a/makefile b/makefile index 03f593a..2c71f5a 100644 --- 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