Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem-wide tap simulation on iOS
    primarykey
    data
    text
    <p>I would like to achieve system-wide tap simulation on iOS, via a MobileSubstrate plugin. The idea is to be able to simulate touches (in a first time single touch, then multitouch) on a system-wide level, in iOS 5.1.1 .</p> <p>I've been successful in implementing <a href="http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html" rel="nofollow">this article</a> to simulate touches on a specific view, I now would like to be able to simulate them system-wide. </p> <p>I understand I should use the private MobileServices framework to do so, and I've <a href="https://github.com/kennytm/iphone-private-frameworks/blob/master/GraphicsServices/GSEvent.h" rel="nofollow">documented myself</a> on GSEvent (I've also looked at Veency &amp; MouseSupport sourcecodes). </p> <p>I tried to hook up a view to intercept UIEvents and look at the underlying structure :</p> <pre><code>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ GSEventRef eventRef = (GSEventRef)[event performSelector:@selector( _gsEvent)]; GSEventRecord record = *_GSEventGetGSEventRecord(eventRef); &lt; breakpoint here to look at record &gt; } </code></pre> <p>and the result is extremely similar to the old (iOS 3) structure detailled above.</p> <p>I then tried to fire up those events myself (on a Standalone app, not a MS tweak for now) : </p> <pre><code>+(void)simulateTouchDown:(CGPoint)point{ point.x = roundf(point.x); point.y = roundf(point.y); GSEventRecord record; memset(&amp;record, 0, sizeof(record)); record.type = kGSEventHand; record.windowLocation = point; record.timestamp = GSCurrentEventTimestamp(); GSSendSystemEvent(&amp;record); } </code></pre> <p>Now, that doesn't work at all (doesn't crash either).</p> <p>Most codes (MouseSupport, Veency) look like this</p> <pre><code>// Create &amp; populate a GSEvent struct { struct GSEventRecord record; struct { struct GSEventRecordInfo info; struct GSPathInfo path; } data; } event; memset(&amp;event, 0, sizeof(event)); event.record.type = kGSEventHand; event.record.windowLocation = point; event.record.timestamp = GSCurrentEventTimestamp(); event.record.infoSize = sizeof(event.data); event.data.info.handInfo.type = kGSHandInfoTypeTouchDown; event.data.info.handInfo._0x44 = 0x1; event.data.info.handInfo._0x48 = 0x1; event.data.info.pathPositions = 1; event.data.path.pathIndex = 0x01; event.data.path.pathIdentity = 0x02; event.data.path.pathProximity = 0x00; event.data.path.pathLocation = event.record.windowLocation; GSSendSystemEvent(&amp;event.record); </code></pre> <p>Only :</p> <ul> <li>GSEventRecordInfo is unknown (and I can't find where it might be defined)</li> <li>I don't see the point of making a whole event to only pass the record</li> </ul> <p>Please someone who's been through this on iOS 5 guide me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload