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 contents in this event will be replaced with the next event.

timeout

The maximum time 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 will wait 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 will be returned.

Returns:

0 if the event was retrieved, or -1 if an error occurred (errno is set).