libei: doc/api/libeis.h File Reference

libei 1.4.1 A library for Emulated Input

Typedefs | Enumerations | Functions
libeis.h File Reference
`#include <stddef.h>`
`#include <stdbool.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Typedefs
typedef void(* | eis_log_handler) (struct eis *eis, enum eis_log_priority priority, const char *message, struct eis_log_context *ctx)
| The log handler for library logging.
typedef uint64_t(* | eis_clock_now_func) (struct eis *eis)
| Optional override function for eis_now().

## Enumerations
enum | eis_device_type { EIS_DEVICE_TYPE_VIRTUAL , EIS_DEVICE_TYPE_PHYSICAL }
| The device type determines what the device represents. More...
enum | eis_device_capability { EIS_DEVICE_CAP_POINTER , EIS_DEVICE_CAP_POINTER_ABSOLUTE , EIS_DEVICE_CAP_KEYBOARD , EIS_DEVICE_CAP_TOUCH , EIS_DEVICE_CAP_SCROLL , EIS_DEVICE_CAP_BUTTON }
enum | eis_keymap_type { EIS_KEYMAP_TYPE_XKB }
enum | eis_event_type { EIS_EVENT_CLIENT_CONNECT , EIS_EVENT_CLIENT_DISCONNECT , EIS_EVENT_SEAT_BIND , EIS_EVENT_DEVICE_CLOSED , EIS_EVENT_PONG , EIS_EVENT_SYNC , EIS_EVENT_FRAME , EIS_EVENT_DEVICE_START_EMULATING , EIS_EVENT_DEVICE_STOP_EMULATING , EIS_EVENT_POINTER_MOTION , EIS_EVENT_POINTER_MOTION_ABSOLUTE , EIS_EVENT_BUTTON_BUTTON , EIS_EVENT_SCROLL_DELTA , EIS_EVENT_SCROLL_STOP , EIS_EVENT_SCROLL_CANCEL , EIS_EVENT_SCROLL_DISCRETE , EIS_EVENT_KEYBOARD_KEY , EIS_EVENT_TOUCH_DOWN , EIS_EVENT_TOUCH_UP , EIS_EVENT_TOUCH_MOTION }
| This enum is not exhaustive, future versions of this library may add new event types. More...
enum | eis_log_priority { EIS_LOG_PRIORITY_DEBUG , EIS_LOG_PRIORITY_INFO , EIS_LOG_PRIORITY_WARNING , EIS_LOG_PRIORITY_ERROR }

## Functions
const char * | eis_event_type_to_string (enum eis_event_type)
| This is a debugging helper to return a string of the name of the event type, or NULL if the event type is invalid.
struct eis * | eis_new (void *user_data)
| Create a new libeis context with a refcount of 1.
unsigned int | eis_log_context_get_line (struct eis_log_context *ctx)
const char * | eis_log_context_get_file (struct eis_log_context *ctx)
const char * | eis_log_context_get_func (struct eis_log_context *ctx)
void | eis_log_set_handler (struct eis *eis, eis_log_handler log_handler)
| Change the log handler for this context.
void | eis_log_set_priority (struct eis *eis, enum eis_log_priority priority)
enum eis_log_priority | eis_log_get_priority (const struct eis *eis)
void | eis_clock_set_now_func (struct eis *, eis_clock_now_func func)
| Override the function that returns the current time eis_now().
struct eis * | eis_ref (struct eis *eis)
struct eis * | eis_unref (struct eis *eis)
void * | eis_get_user_data (struct eis *eis)
void | eis_set_user_data (struct eis *eis, void *user_data)
int | eis_setup_backend_fd (struct eis *ctx)
| Initialize the context that can take pre-configured socket file descriptors, see eis_backend_fd_add_client().
int | eis_backend_fd_add_client (struct eis *ctx)
| Add a new client to a context set up with eis_setup_backend_fd().
int | eis_setup_backend_socket (struct eis *ctx, const char *path)
| Initialize the context with a UNIX socket name.
int | eis_get_fd (struct eis *eis)
| libeis keeps a single file descriptor for all events.
void | eis_dispatch (struct eis *eis)
| Main event dispatching function.
uint64_t | eis_ping_get_id (struct eis_ping *ping)
| Return a unique, increasing id for this struct.
struct eis_ping * | eis_ping_ref (struct eis_ping *eis_ping)
| Increase the refcount of this struct by one.
struct eis_ping * | eis_ping_unref (struct eis_ping *eis_ping)
| Decrease the refcount of this struct by one.
void | eis_ping_set_user_data (struct eis_ping *eis_ping, void *user_data)
| Set a custom data pointer for this struct.
void * | eis_ping_get_user_data (struct eis_ping *eis_ping)
| Return the custom data pointer for this struct.
void | eis_ping (struct eis_ping *ping)
| Issue a roundtrip request to the client, resulting in an EIS_EVENT_PONG event when this roundtrip has been processed.
struct eis_event * | eis_get_event (struct eis *eis)
| Returns the next event in the internal event queue (or NULL) and removes it from the queue.
struct eis_event * | eis_peek_event (struct eis *eis)
| Returns the next event in the internal event queue (or NULL) without removing that event from the queue, i.e.
struct eis_event * | eis_event_unref (struct eis_event *event)
| Release resources associated with this event.
enum eis_event_type | eis_event_get_type (struct eis_event *event)
struct eis_client * | eis_event_get_client (struct eis_event *event)
struct eis_seat * | eis_event_get_seat (struct eis_event *event)
struct eis_ping * | eis_event_pong_get_ping (struct eis_event *event)
| Returns the associated eis_ping struct with this event.
bool | eis_event_seat_has_capability (struct eis_event *event, enum eis_device_capability cap)
| For an event of type EIS_EVENT_SEAT_BIND, return the capabilities requested by the client.
struct eis_device * | eis_event_get_device (struct eis_event *event)
| Return the device from this event.
uint64_t | eis_event_get_time (struct eis_event *event)
| Return the time for the event of type EIS_EVENT_FRAME in microseconds.
struct eis_ping * | eis_client_new_ping (struct eis_client *client)
| Create a new eis_ping object to trigger a round trip to the client.
struct eis_client * | eis_client_ref (struct eis_client *client)
struct eis_client * | eis_client_unref (struct eis_client *client)
void * | eis_client_get_user_data (struct eis_client *eis_client)
void | eis_client_set_user_data (struct eis_client *eis_client, void *user_data)
struct eis * | eis_client_get_context (struct eis_client *client)
bool | eis_client_is_sender (struct eis_client *client)
| Returns true if the client is a sender, false otherwise.
const char * | eis_client_get_name (struct eis_client *client)
| Return the name set by this client.
void | eis_client_connect (struct eis_client *client)
| Allow connection from the client.
void | eis_client_disconnect (struct eis_client *client)
| Disconnect this client.
struct eis_seat * | eis_client_new_seat (struct eis_client *client, const char *name)
| Create a new logical seat with a given name.
struct eis_seat * | eis_seat_ref (struct eis_seat *seat)
struct eis_seat * | eis_seat_unref (struct eis_seat *seat)
struct eis_client * | eis_seat_get_client (struct eis_seat *eis_seat)
const char * | eis_seat_get_name (struct eis_seat *eis_seat)
void * | eis_seat_get_user_data (struct eis_seat *eis_seat)
void | eis_seat_set_user_data (struct eis_seat *eis_seat, void *user_data)
bool | eis_seat_has_capability (struct eis_seat *seat, enum eis_device_capability cap)
void | eis_seat_configure_capability (struct eis_seat *seat, enum eis_device_capability cap)
| Allow a capability on the seat.
void | eis_seat_add (struct eis_seat *seat)
| Add this seat to its client and notify the client of the seat's availability.
void | eis_seat_remove (struct eis_seat *seat)
| Remove this seat and all its remaining devices.
struct eis * | eis_seat_get_context (struct eis_seat *seat)
struct eis * | eis_device_get_context (struct eis_device *device)
struct eis_client * | eis_device_get_client (struct eis_device *device)
struct eis_seat * | eis_device_get_seat (struct eis_device *device)
struct eis_device * | eis_device_ref (struct eis_device *device)
struct eis_device * | eis_device_unref (struct eis_device *device)
void * | eis_device_get_user_data (struct eis_device *eis_device)
void | eis_device_set_user_data (struct eis_device *eis_device, void *user_data)
const char * | eis_device_get_name (struct eis_device *device)
| Return the name of the device.
bool | eis_device_has_capability (struct eis_device *device, enum eis_device_capability cap)
uint32_t | eis_device_get_width (struct eis_device *device)
| Return the width in mm of a device of type EIS_DEVICE_TYPE_PHYSICAL, or zero otherwise.
uint32_t | eis_device_get_height (struct eis_device *device)
| Return the height in mm of a device of type EIS_DEVICE_TYPE_PHYSICAL, or zero otherwise.
struct eis_device * | eis_seat_new_device (struct eis_seat *seat)
| Create a new device on the seat.
void | eis_device_configure_type (struct eis_device *device, enum eis_device_type type)
| Set the device type for this device.
enum eis_device_type | eis_device_get_type (struct eis_device *device)
void | eis_device_configure_name (struct eis_device *device, const char *name)
void | eis_device_configure_capability (struct eis_device *device, enum eis_device_capability cap)
void | eis_device_configure_size (struct eis_device *device, uint32_t width, uint32_t height)
| Configure the size in mm of a device of type EIS_DEVICE_TYPE_PHYSICAL.
struct eis_region * | eis_device_new_region (struct eis_device *device)
| Create a new region on the device of type EIS_DEVICE_TYPE_VIRTUAL with an initial refcount of 1.
void | eis_region_set_size (struct eis_region *region, uint32_t w, uint32_t h)
| This call has no effect if called after eis_region_add()
void | eis_region_set_offset (struct eis_region *region, uint32_t x, uint32_t y)
| This call has no effect if called after eis_region_add()
void | eis_region_set_physical_scale (struct eis_region *region, double scale)
| Set the physical scale for this region.
void | eis_region_set_mapping_id (struct eis_region *region, const char *mapping_id)
| Attach a unique identifier representing an external resource to this region.
const char * | eis_region_get_mapping_id (struct eis_region *region)
| Get the unique ID for this region previously set by this caller, if any, or NULL if the client does not support region mapping id or no region ID has been set.
void | eis_region_add (struct eis_region *region)
| Add the given region to its device.
struct eis_region * | eis_device_get_region (struct eis_device *device, size_t index)
| Obtain a region from the device.
struct eis_region * | eis_device_get_region_at (struct eis_device *device, double x, double y)
| Return the region that contains the given point x/y (in desktop-wide coordinates) or NULL if the coordinates are outside all regions.
struct eis_region * | eis_region_ref (struct eis_region *region)
struct eis_region * | eis_region_unref (struct eis_region *region)
void * | eis_region_get_user_data (struct eis_region *region)
void | eis_region_set_user_data (struct eis_region *region, void *user_data)
uint32_t | eis_region_get_x (struct eis_region *region)
uint32_t | eis_region_get_y (struct eis_region *region)
uint32_t | eis_region_get_width (struct eis_region *region)
uint32_t | eis_region_get_height (struct eis_region *region)
double | eis_region_get_physical_scale (struct eis_region *region)
bool | eis_region_contains (struct eis_region *region, double x, double y)
void | eis_device_add (struct eis_device *device)
| Add this device to its seat and notify the client of the device's availability.
void | eis_device_remove (struct eis_device *device)
| Remove the device.
void | eis_device_pause (struct eis_device *device)
| Notify the client that the device is paused and that no events from the client will be processed.
void | eis_device_resume (struct eis_device *device)
| Notify the client that the capabilities are resumed and that events from the device will be processed.
struct eis_keymap * | eis_device_new_keymap (struct eis_device *device, enum eis_keymap_type type, int fd, size_t size)
| Create a new keymap of the given type.
void | eis_keymap_add (struct eis_keymap *keymap)
| Set the keymap on the device.
size_t | eis_keymap_get_size (struct eis_keymap *keymap)
enum eis_keymap_type | eis_keymap_get_type (struct eis_keymap *keymap)
| Returns the type for this keymap.
int | eis_keymap_get_fd (struct eis_keymap *keymap)
| Return a memmap-able file descriptor pointing to the keymap used by the device.
struct eis_keymap * | eis_keymap_ref (struct eis_keymap *keymap)
struct eis_keymap * | eis_keymap_unref (struct eis_keymap *keymap)
void * | eis_keymap_get_user_data (struct eis_keymap *eis_keymap)
void | eis_keymap_set_user_data (struct eis_keymap *eis_keymap, void *user_data)
struct eis_device * | eis_keymap_get_device (struct eis_keymap *keymap)
| Return the device this keymap belongs to.
struct eis_keymap * | eis_device_keyboard_get_keymap (struct eis_device *device)
| Return the keymap assigned to this device.
void | eis_device_keyboard_send_xkb_modifiers (struct eis_device *device, uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group)
| Notify the client of the current XKB modifier state.
void | eis_device_start_emulating (struct eis_device *device, uint32_t sequence)
| see ei_device_start_emulating
void | eis_device_stop_emulating (struct eis_device *device)
| see ei_device_stop_emulating
void | eis_device_frame (struct eis_device *device, uint64_t time)
| see ei_device_frame
void | eis_device_pointer_motion (struct eis_device *device, double x, double y)
| see ei_device_pointer_motion
void | eis_device_pointer_motion_absolute (struct eis_device *device, double x, double y)
| see ei_device_pointer_motion_absolute
void | eis_device_button_button (struct eis_device *device, uint32_t button, bool is_press)
| see ei_device_button_button
void | eis_device_scroll_delta (struct eis_device *device, double x, double y)
| see ei_device_scroll_delta
void | eis_device_scroll_discrete (struct eis_device *device, int32_t x, int32_t y)
| see ei_device_scroll_discrete
void | eis_device_scroll_stop (struct eis_device *device, bool stop_x, bool stop_y)
| see ei_device_scroll_stop
void | eis_device_scroll_cancel (struct eis_device *device, bool cancel_x, bool cancel_y)
| see ei_device_scroll_cancel
void | eis_device_keyboard_key (struct eis_device *device, uint32_t keycode, bool is_press)
| see ei_device_keyboard_key
struct eis_touch * | eis_device_touch_new (struct eis_device *device)
| see ei_device_touch_new
void | eis_touch_down (struct eis_touch *touch, double x, double y)
| see ei_touch_down
void | eis_touch_motion (struct eis_touch *touch, double x, double y)
| see ei_touch_motion
void | eis_touch_up (struct eis_touch *touch)
| see ei_touch_up
void | eis_touch_cancel (struct eis_touch *touch)
| see ei_touch_cancel
struct eis_touch * | eis_touch_ref (struct eis_touch *touch)
| see ei_touch_ref
struct eis_touch * | eis_touch_unref (struct eis_touch *touch)
| see ei_touch_unref
void | eis_touch_set_user_data (struct eis_touch *touch, void *user_data)
| see ei_touch_set_user_data
void * | eis_touch_get_user_data (struct eis_touch *touch)
| see ei_touch_get_user_data
struct eis_device * | eis_touch_get_device (struct eis_touch *touch)
| see ei_touch_get_device
uint32_t | eis_event_emulating_get_sequence (struct eis_event *event)
| For an event of type EIS_EVENT_DEVICE_START_EMULATING, return the sequence number set by the ei client implementation.
double | eis_event_pointer_get_dx (struct eis_event *event)
| For an event of type EIS_EVENT_POINTER_MOTION return the relative x movement in logical pixels or mm, depending on the device type.
double | eis_event_pointer_get_dy (struct eis_event *event)
| For an event of type EIS_EVENT_POINTER_MOTION return the relative y movement in logical pixels or mm, depending on the device type.
double | eis_event_pointer_get_absolute_x (struct eis_event *event)
| For an event of type EIS_EVENT_POINTER_MOTION_ABSOLUTE return the x position in logical pixels or mm, depending on the device type.
double | eis_event_pointer_get_absolute_y (struct eis_event *event)
| For an event of type EIS_EVENT_POINTER_MOTION_ABSOLUTE return the y position in logical pixels or mm, depending on the device type.
uint32_t | eis_event_button_get_button (struct eis_event *event)
| For an event of type EIS_EVENT_BUTTON_BUTTON return the button code as defined in linux/input-event-codes.h.
bool | eis_event_button_get_is_press (struct eis_event *event)
| For an event of type EIS_EVENT_BUTTON_BUTTON return true if the event is a button press, false for a release.
double | eis_event_scroll_get_dx (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_DELTA return the x scroll distance in logical pixels or mm, depending on the device type.
double | eis_event_scroll_get_dy (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_DELTA return the y scroll distance in logical pixels or mm, depending on the device type.
bool | eis_event_scroll_get_stop_x (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_STOP return whether the x axis has stopped scrolling.
bool | eis_event_scroll_get_stop_y (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_STOP return whether the y axis has stopped scrolling.
int32_t | eis_event_scroll_get_discrete_dx (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_DISCRETE return the x scroll distance in fractions or multiples of 120.
int32_t | eis_event_scroll_get_discrete_dy (struct eis_event *event)
| For an event of type EIS_EVENT_SCROLL_DISCRETE return the y scroll distance in fractions or multiples of 120.
uint32_t | eis_event_keyboard_get_key (struct eis_event *event)
| For an event of type EIS_EVENT_KEYBOARD_KEY return the key code (as defined in include/linux/input-event-codes.h).
bool | eis_event_keyboard_get_key_is_press (struct eis_event *event)
| For an event of type EIS_EVENT_KEYBOARD_KEY return true if the event is a key down, false for a release.
uint32_t | eis_event_touch_get_id (struct eis_event *event)
| For an event of type EIS_EVENT_TOUCH_DOWN, EIS_EVENT_TOUCH_MOTION, or EIS_EVENT_TOUCH_UP, return the tracking ID of the touch.
double | eis_event_touch_get_x (struct eis_event *event)
| For an event of type EIS_EVENT_TOUCH_DOWN, or EIS_EVENT_TOUCH_MOTION, return the x coordinate of the touch in logical pixels or mm, depending on the device type.
double | eis_event_touch_get_y (struct eis_event *event)
| For an event of type EIS_EVENT_TOUCH_DOWN, or EIS_EVENT_TOUCH_MOTION, return the y coordinate of the touch in logical pixels or mm, depending on the device type.
bool | eis_event_touch_get_is_cancel (struct eis_event *event)
| For an event of type EIS_EVENT_TOUCH_UP return true if the touch was cancelled instead of logically released.
uint64_t | eis_now (struct eis *eis)