Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Answer from EntryLevelDev is correct, but some of the value is not so important. I got the below codes from somewhere else and have done some try and errors, here is my codes(worked for till latested ios6).</p> <p>And is anyone working on this for IOS7 now? I could not get it to work. see my post here:<a href="https://stackoverflow.com/questions/17573572/gscopypurplenamedportappid-in-graphicsservices-is-deprecated-in-ios7">With GSCopyPurpleNamedPort(appId) in GraphicsServices deprecated in IOS7, what is the alternative approach?</a></p> <pre><code>static int prev_click = 0; if (!click &amp;&amp; !prev_click) { //which should never enter NSLog(@"***error, postHandEvent cancel"); return; } CGPoint location = CGPointMake(x, y); struct GSTouchEvent { GSEventRecord record; GSHandInfo handInfo; } * event = (struct GSTouchEvent*) &amp;touchEvent; bzero(touchEvent, sizeof(touchEvent)); event-&gt;record.type = kGSEventHand; event-&gt;record.windowLocation = location; event-&gt;record.timestamp = GSCurrentEventTimestamp(); //NSLog(@"Timestamp GSCurrentEventTimestamp: %llu",GSCurrentEventTimestamp()); event-&gt;record.infoSize = sizeof(GSHandInfo) + sizeof(GSPathInfo); event-&gt;handInfo.type = getHandInfoType(prev_click, click); //must have the following line event-&gt;handInfo.x52 = 1; //below line is for ios4 //event-&gt;handInfo.pathInfosCount = 1; bzero(&amp;event-&gt;handInfo.pathInfos[0], sizeof(GSPathInfo)); event-&gt;handInfo.pathInfos[0].pathIndex = 2; //following 2 lines, they are by default event-&gt;handInfo.pathInfos[0].pathMajorRadius = 1.0; event-&gt;handInfo.pathInfos[0].pathPressure = 1.0; //event-&gt;handInfo.pathInfos[0].pathIdentity = 2; event-&gt;handInfo.pathInfos[0].pathProximity = click ? 0x03 : 0x00; //event-&gt;handInfo.pathInfos[0].pathProximity = action; event-&gt;handInfo.pathInfos[0].pathLocation = location; // send GSEvent GSEventRecord *event1 = (GSEventRecord*) event; sendGSEvent(event1); </code></pre>
 

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