screen_get_event()

Wait for a screen event

Synopsis:

#include <screen/screen.h>
int screen_get_event(screen_context_t ctx,
                     screen_event_t ev,
                     uint64_t timeout)

Arguments:

ctx
The context to retrieve events from. This context must have been created using screen_create_context().
ev
An event previously allocated with screen_create_event(). Any content in this event is replaced with the next event.
timeout
The maximum time (in nanoseconds) to wait for an event to occur, if one has not been queued up already. 0 indicates that the call must not wait at all if there are no events associated with the specified context. -1 indicates that the call must not return until an event is ready.

Library:

libscreen

Description:

Function Type: Immediate Execution

This function gets the next event associated with the given context. If no events have been queued, the function waits up to the specified amount of time for an event to occur. If the function times out before an event becomes available, an event with a SCREEN_EVENT_NONE type is returned.

Returns:

0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).