Emit an event when the event-specific data isn't contiguous in memory


int PhEmitmx( PhEvent_t const *event,
              PhRect_t const *rects,
              int mxparts,
              iov_t *mx );




This function provides an alternative to PhEmit(). You'll find it useful when the event-specific data isn't contiguous in memory.

The mx argument points to an array of iov_t entries, and mxparts contains the number of mx entries pointed to by mx. You should leave the first three entries of mx blank; these are filled in by PhEmitmx(). You can use the remaining entries to build a description of the data to be attached to the event. If event->data_len isn't 0, then the event data must be at least event->data_len bytes long.

The event argument points to a PhEvent_t structure.

The rects argument points to an array of PhRect_t structures that define the rectangles associated with the event. If event->num_rects isn't 0, then rects must point to an array of event->num_rects valid rectangles.


A nonnegative value
Successful completion.
An error occurred; check the value of errno.


The following example emits a pointer press event. (A call to PhEmit() is just as efficient and slightly more convenient.)

#include <stdio.h>
#include <time.h>
#include <Ph.h>

int main( int argc, char *argv[] )
     PhEvent_t event = { 0 };
     PhRect_t rect;
     PhPointerEvent_t ptr_event;
     iov_t mx[4];

     if( NULL == PhAttach( NULL, NULL ) ) {
          fprintf( stderr,
                 "Could not attach a Photon channel.\n");
          exit( EXIT_FAILURE );
     event.type = Ph_EV_BUT_PRESS;
     event.subtype = 0;
     event.emitter.rid = Ph_DEV_RID;
     event.flags = 0;
     event.num_rects = 1;
     event.data_len = sizeof( ptr_event );
     rect.ul.x = = 100;
     rect.ul.y = = 200;
     ptr_event.flags = 0;
     ptr_event.buttons = Ph_BUTTON_SELECT;
     SETIOV( &mx[3], &ptr_event, sizeof( ptr_event ) );
     PhEmitmx( &event, &rect, 4, mx );

     return EXIT_SUCCESS;



Interrupt handler No
Signal handler No
Thread No

See also:

PgFlush(), PhEvent_t, PhEmit(), PhPointerEvent_t, PhRect_t

Emitting events in the Events chapter of the Photon Programmer's Guide.

MsgSendv(), SETIOV() in the QNX Neutrino Library Reference