libei.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef void(* ei_log_handler) (struct ei *ei, enum ei_log_priority priority, const char *message, bool is_continuation)
 The log handler for library logging. More...
 

Enumerations

enum  ei_device_capability { EI_DEVICE_CAP_POINTER, EI_DEVICE_CAP_POINTER_ABSOLUTE, EI_DEVICE_CAP_KEYBOARD, EI_DEVICE_CAP_TOUCH }
 The set of supported capabilities. More...
 
enum  ei_keymap_type { EI_KEYMAP_TYPE_XKB }
 The set of supported keymap types for a struct ei_keymap. More...
 
enum  ei_keymap_source { EI_KEYMAP_SOURCE_CLIENT, EI_KEYMAP_SOURCE_SERVER }
 Identifies who provided a struct ei_keymap. More...
 
enum  ei_event_type {
  EI_EVENT_CONNECT, EI_EVENT_DISCONNECT, EI_EVENT_SEAT_ADDED, EI_EVENT_SEAT_REMOVED,
  EI_EVENT_DEVICE_ADDED, EI_EVENT_DEVICE_REMOVED, EI_EVENT_DEVICE_SUSPENDED, EI_EVENT_DEVICE_RESUMED
}
 
enum  ei_log_priority { EI_LOG_PRIORITY_DEBUG, EI_LOG_PRIORITY_INFO, EI_LOG_PRIORITY_WARNING, EI_LOG_PRIORITY_ERROR }
 

Functions

struct eiei_new (void *user_data)
 Create a new ei context. More...
 
void ei_log_set_handler (struct ei *ei, ei_log_handler log_handler)
 Change the log handler for this context. More...
 
void ei_log_set_priority (struct ei *ei, enum ei_log_priority priority)
 
enum ei_log_priority ei_log_get_priority (const struct ei *ei)
 
void ei_configure_name (struct ei *ei, const char *name)
 Set the name for this client. More...
 
int ei_setup_backend_socket (struct ei *ei, const char *socketpath)
 Set this ei context to use the socket backend. More...
 
int ei_setup_backend_fd (struct ei *ei, int fd)
 Initialize the ei context on the given socket. More...
 
int ei_setup_backend_portal (struct ei *ei)
 Connect to the org.freedesktop.portal.Desktop portal. More...
 
int ei_setup_backend_portal_busname (struct ei *ei, const char *busname)
 Connect to an org.freedesktop.portal.Desktop implementation on the given busname. More...
 
struct eiei_ref (struct ei *ei)
 Increase the refcount of this struct by one. More...
 
struct eiei_unref (struct ei *ei)
 Decrease the refcount of this struct by one. More...
 
void ei_set_user_data (struct ei *ei, void *user_data)
 Set a custom data pointer for this context. More...
 
void * ei_get_user_data (struct ei *ei)
 Return the custom data pointer for this context. More...
 
int ei_get_fd (struct ei *ei)
 libei keeps a single file descriptor for all events. More...
 
void ei_dispatch (struct ei *ei)
 Main event dispatching function. More...
 
struct ei_eventei_get_event (struct ei *ei)
 Return the next event from the event queue, removing it from the queue. More...
 
struct ei_eventei_peek_event (struct ei *ei)
 Returns the next event in the internal event queue (or NULL) without removing that event from the queue; the next call to ei_get_event() will return that same event. More...
 
struct ei_eventei_event_unref (struct ei_event *event)
 Release resources associated with this event. More...
 
const char * ei_seat_get_name (struct ei_seat *seat)
 
bool ei_seat_has_capability (struct ei_seat *seat, enum ei_device_capability cap)
 
struct ei_seatei_seat_ref (struct ei_seat *seat)
 
struct ei_seatei_seat_unref (struct ei_seat *seat)
 
struct eiei_seat_get_context (struct ei_seat *seat)
 Return the struct EI - the client implementation context this seat is associated with. More...
 
enum ei_event_type ei_event_get_type (struct ei_event *event)
 
struct ei_deviceei_event_get_device (struct ei_event *event)
 Return the device from this event. More...
 
uint64_t ei_event_get_time (struct ei_event *event)
 
struct ei_deviceei_device_ref (struct ei_device *device)
 Increase the refcount of this struct by one. More...
 
struct ei_deviceei_device_unref (struct ei_device *device)
 Decrease the refcount of this struct by one. More...
 
struct ei_deviceei_device_new (struct ei_seat *ei_seat)
 Create a new device in the given seat. More...
 
struct ei_seatei_device_get_seat (struct ei_device *device)
 
void ei_seat_set_user_data (struct ei_seat *seat, void *user_data)
 Set a custom data pointer for this context. More...
 
void * ei_seat_get_user_data (struct ei_seat *seat)
 Return the custom data pointer for this context. More...
 
void ei_device_set_user_data (struct ei_device *device, void *user_data)
 Set a custom data pointer for this context. More...
 
void * ei_device_get_user_data (struct ei_device *device)
 Return the custom data pointer for this context. More...
 
void ei_device_configure_name (struct ei_device *device, const char *name)
 Set the name for this device. More...
 
bool ei_device_configure_capability (struct ei_device *device, enum ei_device_capability cap)
 Enable the given capability on this device. More...
 
void ei_device_pointer_configure_range (struct ei_device *device, uint32_t width, uint32_t height)
 Set the range of the absolute pointer device in logical pixels. More...
 
void ei_device_touch_configure_range (struct ei_device *device, uint32_t width, uint32_t height)
 Set the range of the touch device in logical pixels. More...
 
struct ei_keymapei_keymap_new (enum ei_keymap_type type, int fd, size_t size)
 Create a new keymap of the given type. More...
 
size_t ei_keymap_get_size (struct ei_keymap *keymap)
 
enum ei_keymap_type ei_keymap_get_type (struct ei_keymap *keymap)
 Returns the type for this keymap. More...
 
int ei_keymap_get_fd (struct ei_keymap *keymap)
 Return a memmap-able file descriptor pointing to the keymap used by the device. More...
 
enum ei_keymap_source ei_keymap_get_source (struct ei_keymap *keymap)
 Returns the source for the keymap on this device, if any. More...
 
struct ei_deviceei_keymap_get_device (struct ei_keymap *keymap)
 Return the device this keymap belongs to, or NULL if it has not yet been assigned to a device. More...
 
struct ei_keymapei_keymap_ref (struct ei_keymap *keymap)
 Increase the refcount of this struct by one. More...
 
struct ei_keymapei_keymap_unref (struct ei_keymap *keymap)
 Decrease the refcount of this struct by one. More...
 
void ei_device_keyboard_configure_keymap (struct ei_device *device, struct ei_keymap *keymap)
 Request this keymap for this device with the EI_DEVICE_CAP_KEYBOARD capability. More...
 
void ei_device_add (struct ei_device *device)
 Request that the device be added to the server. More...
 
void ei_device_remove (struct ei_device *device)
 Notify the server that the device should be removed. More...
 
const char * ei_device_get_name (struct ei_device *device)
 Return the name of this device. More...
 
bool ei_device_has_capability (struct ei_device *device, enum ei_device_capability cap)
 Return true if the device has the requested capability. More...
 
uint32_t ei_device_pointer_get_width (struct ei_device *device)
 Return the requested width for an EI_DEVICE_CAP_POINTER_ABSOLUTE device. More...
 
uint32_t ei_device_pointer_get_height (struct ei_device *device)
 Return the requested height for an EI_DEVICE_CAP_POINTER_ABSOLUTE device. More...
 
uint32_t ei_device_touch_get_width (struct ei_device *device)
 Return the requested width for an EI_DEVICE_CAP_TOUCH device. More...
 
uint32_t ei_device_touch_get_height (struct ei_device *device)
 Return the requested height for an EI_DEVICE_CAP_TOUCH device. More...
 
struct ei_keymapei_device_keyboard_get_keymap (struct ei_device *device)
 Return the keymap for this device or NULL. More...
 
struct ei_deviceei_keymap_get_context (struct ei_keymap *keymap)
 Return the struct ei_device this keymap is associated with. More...
 
struct eiei_device_get_context (struct ei_device *device)
 Return the struct EI - the client implementation context this device is associated with. More...
 
void ei_device_pointer_motion (struct ei_device *device, double x, double y)
 Generate a relative motion event on a device with the EI_DEVICE_CAP_POINTER capability. More...
 
void ei_device_pointer_motion_absolute (struct ei_device *device, double x, double y)
 Generate an absolute motion event on a device with the EI_DEVICE_CAP_POINTER_ABSOLUTE capability. More...
 
void ei_device_pointer_button (struct ei_device *device, uint32_t button, bool is_press)
 Generate a button event on a device with the EI_DEVICE_CAP_POINTER_ABSOLUTE or EI_DEVICE_CAP_POINTER capability. More...
 
void ei_device_pointer_scroll (struct ei_device *device, double x, double y)
 Generate a scroll event on a device with the EI_DEVICE_CAP_POINTER_ABSOLUTE or EI_DEVICE_CAP_POINTER capability. More...
 
void ei_device_pointer_scroll_discrete (struct ei_device *device, int32_t x, int32_t y)
 Generate a discrete scroll event on a device with the EI_DEVICE_CAP_POINTER_ABSOLUTE or EI_DEVICE_CAP_POINTER capability. More...
 
void ei_device_keyboard_key (struct ei_device *device, uint32_t keycode, bool is_press)
 Generate a key event on a device with the EI_DEVICE_CAP_KEYBOARD capability. More...
 
struct ei_touch * ei_device_touch_new (struct ei_device *device)
 Initiate a new touch on a device with the EI_DEVICE_CAP_TOUCH capability. More...
 
void ei_touch_down (struct ei_touch *touch, double x, double y)
 This function can only be called once on an ei_touch object. More...
 
void ei_touch_motion (struct ei_touch *touch, double x, double y)
 Move this touch to the new coordinates. More...
 
void ei_touch_up (struct ei_touch *touch)
 Release this touch. More...
 
struct ei_touch * ei_touch_ref (struct ei_touch *touch)
 Increase the refcount of this struct by one. More...
 
struct ei_touch * ei_touch_unref (struct ei_touch *touch)
 Decrease the refcount of this struct by one. More...
 
void ei_touch_set_user_data (struct ei_touch *touch, void *user_data)
 Return the custom data pointer for this context. More...
 
void * ei_touch_get_user_data (struct ei_touch *touch)
 Set a custom data pointer for this context. More...
 
struct ei_deviceei_touch_get_device (struct ei_touch *touch)
 
struct ei_seatei_event_get_seat (struct ei_event *event)
 Return the seat from this event. More...