Note that there are some explanatory texts on larger screens.

plurals
  1. POGSSendEvent - Inject Touch Event iOS
    primarykey
    data
    text
    <p>I want to inject touch event in iPhone. I get the coordinates of touch event via network socket. GSSendEvent seems to be good choice. However, it needs GSEventRecord as one of the inputs. </p> <p>Does anyone know how to prepare GSEventRecord? I prepared it based on some examples but the app crashes after GSSendEvent call.</p> <p>Appreciate any help.</p> <pre><code>-(void) handleMouseEventAtPoint:(CGPoint) point { static mach_port_t port_; // structure of touch GSEvent struct GSTouchEvent { GSEventRecord record; GSHandInfo handInfo; } ; struct GSTouchEvent *touchEvent = (struct GSTouchEvent *) malloc(sizeof(struct GSTouchEvent)); bzero(touchEvent, sizeof(touchEvent)); // set up GSEvent touchEvent-&gt;record.type = kGSEventHand; touchEvent-&gt;record.windowLocation = point; touchEvent-&gt;record.timestamp = GSCurrentEventTimestamp(); touchEvent-&gt;record.infoSize = sizeof(GSHandInfo) + sizeof(GSPathInfo); touchEvent-&gt;handInfo.type = getHandInfoType(0, 1); touchEvent-&gt;handInfo.pathInfosCount = 1; bzero(&amp;touchEvent-&gt;handInfo.pathInfos[0], sizeof(GSPathInfo)); touchEvent-&gt;handInfo.pathInfos[0].pathIndex = 1; touchEvent-&gt;handInfo.pathInfos[0].pathIdentity = 2; touchEvent-&gt;handInfo.pathInfos[0].pathProximity = 1 ? 0x03 : 0x00; touchEvent-&gt;handInfo.pathInfos[0].pathLocation = point; port_ = GSGetPurpleSystemEventPort(); GSSendEvent((GSEventRecord*)touchEvent ,port_); } static GSHandInfoType getHandInfoType(int touch_before, int touch_now){ if (!touch_before) { return (GSHandInfoType) kGSHandInfoType2TouchDown; } if (touch_now) { return (GSHandInfoType) kGSHandInfoType2TouchChange; } return (GSHandInfoType) kGSHandInfoType2TouchFinal; } </code></pre>
    singulars
    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.
 

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