]> git.saurik.com Git - veency.git/commitdiff
Send [0.0,1.0) x,y coordinates, to system client.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 14 Jul 2014 01:38:54 +0000 (18:38 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 14 Jul 2014 01:43:18 +0000 (18:43 -0700)
Tweak.mm

index 04f9b016e384ba442815c9e56779c7a1f778c47a..e0377fea939cd4b6123abfd7bd0541fc269153cf 100644 (file)
--- a/Tweak.mm
+++ b/Tweak.mm
@@ -66,8 +66,6 @@ MSClassHook(UIApplication)
 
 @interface CAWindowServerDisplay : NSObject
 - (mach_port_t) clientPortAtPosition:(CGPoint)position;
-- (unsigned) contextIdAtPosition:(CGPoint)position;
-- (mach_port_t) taskPortOfContextId:(unsigned)context;
 @end
 
 @interface CAWindowServer : NSObject
@@ -98,14 +96,6 @@ MSClassHook(UIApplication)
 - (void) removeStatusBarItem:(NSString *)item;
 @end
 
-@interface BKHIDClientConnectionManager : NSObject
-- (IOHIDEventSystemConnectionRef) clientForTaskPort:(mach_port_t)port;
-@end
-
-@interface BKAccessibility : NSObject
-+ (BKHIDClientConnectionManager *) _eventRoutingClientConnectionManager;
-@end
-
 typedef void *CoreSurfaceBufferRef;
 
 extern CFStringRef kCoreSurfaceBufferGlobal;
@@ -643,27 +633,16 @@ static void VNCPointerNew(int buttons, int x, int y, CGPoint location, int diff,
         fingerm = kIOHIDDigitizerEventRange | kIOHIDDigitizerEventTouch;
     } else return;
 
-    CAWindowServer *server([CAWindowServer serverIfRunning]);
-    if (server == nil)
-        return;
-
-    CAWindowServerDisplay *display([[server displays] objectAtIndex:0]);
-    if (display == nil)
-        return;
-
-    unsigned context([display contextIdAtPosition:CGPointMake(x, y)]);
-    mach_port_t port([display taskPortOfContextId:context]);
-    if (port == MACH_PORT_NULL)
-        return;
+    // XXX: avoid division in VNCPointer()
+    x *= ratio_;
+    y *= ratio_;
 
-    IOHIDEventSystemConnectionRef connection([[$BKAccessibility _eventRoutingClientConnectionManager] clientForTaskPort:port]);
-    if (connection == NULL)
-        return;
-
-    // XXX: I guess this isn't ambiguous, and it works
     IOHIDFloat xf(x);
     IOHIDFloat yf(y);
 
+    xf /= width_;
+    yf /= height_;
+
     IOHIDEventRef hand(IOHIDEventCreateDigitizerEvent(kCFAllocatorDefault, mach_absolute_time(), kIOHIDDigitizerTransducerTypeHand, 1<<22, 1, handm, 0, xf, yf, 0, 0, 0, 0, 0, 0));
     IOHIDEventSetIntegerValue(hand, kIOHIDEventFieldIsBuiltIn, true);
     IOHIDEventSetIntegerValue(hand, kIOHIDEventFieldDigitizerIsDisplayIntegrated, true);
@@ -672,9 +651,7 @@ static void VNCPointerNew(int buttons, int x, int y, CGPoint location, int diff,
     IOHIDEventAppendEvent(hand, finger);
     CFRelease(finger);
 
-    VNCSetSender(hand);
-    IOHIDEventSystemConnectionDispatchEvent(connection, hand);
-    CFRelease(hand);
+    VNCSendHIDEvent(hand);
 }
 
 GSEventRef (*$GSEventCreateKeyEvent)(int, CGPoint, CFStringRef, CFStringRef, id, UniChar, short, short);