screen_send_event()

Send an input event to a process.

Synopsis:

#include <screen/screen.h>
 
int screen_send_event(screen_context_t ctx, screen_event_t ev, pid_t pid)

Arguments:

ctx

A context within the UI Framework that was created with screen_create_context().

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.

pid

The process the event is to be sent to.

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. When using screen_inject_event(), the event will be sent 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 the event was sent to the specified process, or -1 if an error occurred (errno is set).