Send an input event to a process
#include <screen/screen.h>
int screen_send_event(screen_context_t ctx, screen_event_t ev, pid_t pid)
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_send_event(), you must have set all relevant event properties to valid values, especially the event type property.
0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).