Events are associated with a given context.
The windowing system manages an event queue per context. An event can be transferred from the event queue to the application by using screen_get_event(). Once transferred to the application, it can be used with screen_get_event_property() in an event handling routine to handle the event accordingly.
...
screen_event_t screen_ev;
screen_create_event(&screen_ev);
while (1){
do {
/* Call screen_get_event with a timeout of -1, or ~0, so that you block
until an event is put into the event queue. */
screen_get_event(screen_ctx, screen_ev, vis ? 0 : ~0);
/* Get the type of the event */
screen_get_event_property_iv(screen_ev, SCREEN_PROPERTY_TYPE, &type);
/* Handle events of interest to your application */
if (type == SCREEN_EVENT_POST) {
/* Handle SCREEN_EVENT_POST event accordingly;
query or set properties valid for POST events */
}
else if (type == SCREEN_EVENT_CLOSE) {
/* Handle SCREEN_EVENT_CLOSE event accordingly;
query or set properties valid for CLOSE events */
}
else if
...
} while (type != SCREEN_EVENT_NONE);
}
...