]> git.saurik.com Git - veency.git/commitdiff
I am really starting to hate Apple's IOMobileCrap. v0.9.3197
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 14 Jun 2010 08:48:17 +0000 (08:48 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 14 Jun 2010 08:48:17 +0000 (08:48 +0000)
Tweak.mm
control

index 0834b08753b172d81358376c895f83bff62b2543..18ad95db09d6be58b24216ace2b3db9225f52d15 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -37,6 +37,8 @@
 
 #define _trace() \
     fprintf(stderr, "_trace()@%s:%u[%s]\n", __FILE__, __LINE__, __FUNCTION__)
+#define _likely(expr) \
+    __builtin_expect(expr, 1)
 #define _unlikely(expr) \
     __builtin_expect(expr, 0)
 
@@ -283,7 +285,7 @@ static rfbBool VNCCheck(rfbClientPtr client, const char *data, int size) {
 static void VNCPointer(int buttons, int x, int y, rfbClientPtr client) {
     CGPoint location = {x, y};
 
-    if (Level_ == 2) {
+    if (width_ > height_) {
         int t(x);
         x = height_ - 1 - y;
         y = t;
@@ -579,6 +581,10 @@ static void VNCNotifyEnabled(
     VNCEnabled();
 }
 
+void (*$IOMobileFramebufferIsMainDisplay)(IOMobileFramebufferRef, bool *);
+
+static IOMobileFramebufferRef main_;
+
 MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer,
     IOMobileFramebufferRef fb,
     int layer,
@@ -587,6 +593,21 @@ MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer,
     CGRect frame,
     int flags
 ) {
+    bool main = false;
+
+    if (_unlikely(buffer == NULL))
+        main = fb == main_;
+    else if (_unlikely(fb == NULL))
+        main = false;
+    else if ($IOMobileFramebufferIsMainDisplay == NULL)
+        main = true;
+    else
+        (*$IOMobileFramebufferIsMainDisplay)(fb, &main);
+
+    if (_likely(main))
+        main_ = fb;
+    else goto pass;
+
     if (_unlikely(width_ == 0 || height_ == 0)) {
         CGSize size;
         IOMobileFramebufferGetDisplaySize(fb, &size);
@@ -594,6 +615,9 @@ MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer,
         width_ = size.width;
         height_ = size.height;
 
+        if (width_ == 0 || height_ == 0)
+            goto pass;
+
         NSThread *thread([NSThread alloc]);
 
         [thread
@@ -628,6 +652,7 @@ MSHook(kern_return_t, IOMobileFramebufferSwapSetLayer,
         rfbMarkRectAsModified(screen_, 0, 0, width_, height_);
     }
 
+  pass:
     return _IOMobileFramebufferSwapSetLayer(fb, layer, buffer, bounds, frame, flags);
 }
 
@@ -665,6 +690,7 @@ MSInitialize {
 
     dlset($GSEventCreateKeyEvent, "GSEventCreateKeyEvent");
     dlset($GSCreateSyntheticKeyEvent, "_GSCreateSyntheticKeyEvent");
+    dlset($IOMobileFramebufferIsMainDisplay, "IOMobileFramebufferIsMainDisplay");
 
     MSHookFunction(&IOMobileFramebufferSwapSetLayer, MSHake(IOMobileFramebufferSwapSetLayer));
     MSHookFunction(&rfbRegisterSecurityHandler, MSHake(rfbRegisterSecurityHandler));
diff --git a/control b/control
index b4343b6070fc86fb779f23e146d655b692f888a8..0c03c2bba3300df1d2f767146f74e07e1126c604 100644 (file)
--- a/control
+++ b/control
@@ -5,7 +5,7 @@ Priority: optional
 Section: Networking
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
-Version: 0.9.3193-1
+Version: 0.9.3197-1
 Description: a VNC /server/ for the iPhone
 Name: Veency
 Depends: mobilesubstrate (>= 0.9.2966-1), libvncserver, com.saurik.iphone.ske, preferenceloader, jp.ashikase.mousesupport | firmware (<< 3.0)