Home Forums Software Development Problem with receiving interaction events Reply To: Problem with receiving interaction events

#1098
Jenny [Tobii]
Participant

Hi Veronika,

Yes, that description in the documentation is a simplified description of how it works.

To answer your questions I have to make a distinction between region-bound interactors and global interactors, because the engine treats these different kinds of interactors differently. Region-bound interactors are interactors that have an EyeX behavior that is limited to a certain region on the screen – for example an Activatable button. Global interactors are interactors with EyeX behaviors that are not tied to a specific region on the screen, but will rather receive a stream of events – for example a data stream of gaze point events of where on the screen the user is looking.

Based on your questions, I am assuming that what you are trying to achieve is regarding region-bound interactors, so I will answer them for the region-bound case. I am further assuming that you want to EyeX enable an application for which you don’t have access to the source code, so that the WinForms or WPF EyeX frameworks included in the .NET SDK are not feasible.

Answers:
1. The engine keeps track of which client has sent it a certain region-bound interactor in a snapshot by prefixing the interactor id with a unique client id. So, when the engine has discovered that the user has interacted with a certain interactor, it can direct the event (with the client prefix removed from the interactor id) to the client that sent the interactor to the engine. So, the “owning” client is really the client that sent the interactor in a snapshot.
1.1 While the answer above is correct for a single interactor and client, it does not give the whole picture of how it works. The window id is also important, and so are the bounds of the snapshot that includes the interactor. When the engine receives a snapshot with interactors with window ids, it will consider this snapshot the complete and latest description of everything that is within the snapshot bounds for the respective window. Let’s say we have two snapshots sent after each other to the engine, and that they have the same snapshot bounds, but the first snapshot contains a single interactor with id = ‘A’, and window id = 1, and the second snapshot contains a single interactor with id = ‘B’, and window id = 1. From the engine’s perspective, as soon as the second snapshot is received, the interactor ‘B’ is the only existing interactor in window 1 within the snapshot bounds (no matter of the bounds of the individual interactors). If interactors ‘A’ and ‘B’ in the previous example would instead have different window id:s, then after the second snapshot was received, they would both be considered to exist, in different windows. If the snapshot bounds of the two snapshots were non-overlapping, they would update the engine’s information about the different regions independenlty, without interfering with each other. In conclusion, it is therefore important to include all the currently existing interactors within the snapshot bounds of the respective windows in each and every snapshot sent to the engine.
2. Now, can a client application get events for an interactor that “belongs” to another window – say a button or region within another application’s window? Yes, it can, simply by sending a snapshot to the engine with the correct bounds and window id set for the interactor. But, please consider the following when EyeX enabling another application’s window: if that other application is itself a client application to the EyeX Engine, you would end up in a situation where two client applications are sending snapshots about the same window and regions of the screen simultaneously to the engine. Since the interactor ids will always be distinct due to the client prefix, the interactor information in the snapshots would constantly replace each other and the engine’s view of existing interactors, and it would be a race condition which client application would get a certain interaction event.

When it comes to the WinForms and WPF EyeX frameworks in the .NET SDK, they take care of the creation and sending of snapshots with region-bound interactors to the EyeX Engine under the hood. If you are using any of these frameworks and are not receiving interaction events, then there is a different kind of problem.

For further reading and understanding of the differences between region-bound and global interactors, please see the sections “Interactors” and “The Query-Snapshot Cycle” in the Developer’s Guide.