screen_inject_event()

Send an input event to the window that has input focus on a given display

Synopsis:

#include <screen/screen.h>
int screen_inject_event(screen_display_t disp,
                        screen_event_t ev)

Arguments:

disp
The display into which the event is injected. You can obtain a handle to the display by either screen_get_context_property() or screen_get_window_property() functions.
ev
An event handle that was created with screen_create_event(). This event must contain all the relevant event data pertaining to its type when injected into the system.

Library:

libscreen

Description:

Function Type: Immediate Execution

A window manager and an input provider can use this function when they need to inject an event in the system. You need to be within a privileged context to be able to inject input events. You can create a privileged context by calling the function screen_create_context() with a context type of SCREEN_WINDOW_MANAGER_CONTEXT or SCREEN_INPUT_PROVIDER_CONTEXT. Prior to calling screen_inject_event(), you must have set all relevant event properties to valid values, especially the event type property. This function sends the event to the window that has input focus on the specified display. If you want to send an event to a particular window other than the one who has input focus, then use screen_send_event().

Returns:

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