libei
0.2
A library for Emulated Input
|
libeis is the server-side module. More...
Data Structures | |
struct | eis_region |
Regions are only available on devices of type EIS_DEVICE_TYPE_VIRTUAL. More... | |
Typedefs | |
typedef void(* | eis_log_handler) (struct eis *eis, enum eis_log_priority priority, const char *file, int lineno, const char *func, const char *message, bool is_continuation) |
The log handler for library logging. More... | |
Functions | |
struct eis * | eis_new (void *user_data) |
Create a new libeis context with a refcount of 1. More... | |
void | eis_log_set_handler (struct eis *eis, eis_log_handler log_handler) |
Change the log handler for this context. More... | |
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) |
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) |
bool | eis_client_is_sender (struct eis_client *client) |
Returns true if the client is a sender, false otherwise. More... | |
void | eis_client_property_set (struct eis_client *client, const char *property, const char *value) |
See eis_client_property_set_with_permissions(), but the permissions are left as-is. More... | |
void | eis_client_property_set_with_permissions (struct eis_client *client, const char *property, const char *value, uint32_t permission) |
Change, create or delete a property. More... | |
uint32_t | eis_client_property_get_permissions (struct eis_client *client, const char *propert) |
Return the permissions mask for the given property. More... | |
const char * | eis_client_property_get (struct eis_client *client, const char *property) |
Return the value of the given property or NULL if the property is not set. More... | |
int | eis_setup_backend_socket (struct eis *ctx, const char *path) |
Initialize the context with a UNIX socket name. More... | |
int | eis_setup_backend_fd (struct eis *ctx) |
Initialize the context that can take pre-configured sockets. More... | |
int | eis_backend_fd_add_client (struct eis *ctx) |
Add a new client to a context set up with eis_setup_backend_fd(). More... | |
int | eis_get_fd (struct eis *eis) |
libeis keeps a single file descriptor for all events. More... | |
void | eis_dispatch (struct eis *eis) |
Main event dispatching function. More... | |
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. More... | |
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. More... | |
struct eis_event * | eis_event_unref (struct eis_event *event) |
Release resources associated with this event. More... | |
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) |
const char * | eis_client_get_name (struct eis_client *client) |
Return the name set by this client. More... | |
void | eis_client_connect (struct eis_client *client) |
Allow connection from the client. More... | |
void | eis_client_disconnect (struct eis_client *client) |
Disconnect this client. More... | |
struct eis_seat * | eis_client_new_seat (struct eis_client *client, const char *name) |
Create a new logical seat with a given name. More... | |
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) |
bool | eis_seat_has_capability (struct eis_seat *seat, enum eis_device_capability cap) |
void | eis_seat_set_user_data (struct eis_seat *eis_seat, void *user_data) |
void | eis_seat_configure_capability (struct eis_seat *seat, enum eis_device_capability cap) |
Allow a capability on the seat. More... | |
void | eis_seat_add (struct eis_seat *seat) |
Add this seat to its client and notify the client of the seat's availability. More... | |
void | eis_seat_remove (struct eis_seat *seat) |
Remove this seat and all its remaining devices. More... | |
enum eis_event_type | eis_event_get_type (struct eis_event *event) |
struct eis_client * | eis_event_get_client (struct eis_event *event) |
const char * | eis_event_property_get_name (struct eis_event *event) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the property name that has changed. More... | |
const char * | eis_event_property_get_value (struct eis_event *event) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the new property value (at the time of the event). More... | |
uint32_t | eis_event_property_get_permissions (struct eis_event *event) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the permissions of the property (at the time of the event). More... | |
struct eis_seat * | eis_event_get_seat (struct eis_event *event) |
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. More... | |
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. More... | |
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. More... | |
struct eis_device * | eis_seat_new_device (struct eis_seat *seat) |
Create a new device on the seat. More... | |
void | eis_device_configure_type (struct eis_device *device, enum eis_device_type type) |
Set the device type for this device. More... | |
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. More... | |
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. More... | |
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() More... | |
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() More... | |
void | eis_region_set_physical_scale (struct eis_region *region, double scale) |
Set the physical scale for this region. More... | |
void | eis_region_add (struct eis_region *region) |
Add the given region to its device. More... | |
struct eis_region * | eis_device_get_region (struct eis_device *device, size_t index) |
Obtain a region from the device. More... | |
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) |
void | eis_device_add (struct eis_device *device) |
Add this device to its seat and notify the client of the device's availability. More... | |
void | eis_device_remove (struct eis_device *device) |
Remove the device. More... | |
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. More... | |
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. More... | |
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. More... | |
void | eis_keymap_add (struct eis_keymap *keymap) |
Set the keymap on the device. More... | |
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. More... | |
int | eis_keymap_get_fd (struct eis_keymap *keymap) |
Return a memmap-able file descriptor pointing to the keymap used by the device. More... | |
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. More... | |
struct eis_keymap * | eis_device_keyboard_get_keymap (struct eis_device *device) |
Return the keymap assigned to this device. More... | |
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. More... | |
void | eis_device_start_emulating (struct eis_device *device) |
see ei_device_start_emulating More... | |
void | eis_device_stop_emulating (struct eis_device *device) |
see ei_device_stop_emulating More... | |
void | eis_device_frame (struct eis_device *device) |
see ei_device_frame More... | |
void | eis_device_pointer_motion (struct eis_device *device, double x, double y) |
see ei_device_pointer_motion More... | |
void | eis_device_pointer_motion_absolute (struct eis_device *device, double x, double y) |
see ei_device_pointer_motion_absolute More... | |
void | eis_device_pointer_button (struct eis_device *device, uint32_t button, bool is_press) |
see ei_device_pointer_button More... | |
void | eis_device_pointer_scroll (struct eis_device *device, double x, double y) |
see ei_device_pointer_scroll More... | |
void | eis_device_pointer_scroll_discrete (struct eis_device *device, int32_t x, int32_t y) |
see ei_device_pointer_scroll_discrete More... | |
void | eis_device_pointer_scroll_stop (struct eis_device *device, bool stop_x, bool stop_y) |
see ei_device_pointer_scroll_stop More... | |
void | eis_device_pointer_scroll_cancel (struct eis_device *device, bool cancel_x, bool cancel_y) |
see ei_device_pointer_scroll_cancel More... | |
void | eis_device_keyboard_key (struct eis_device *device, uint32_t keycode, bool is_press) |
see ei_device_keyboard_key More... | |
struct eis_touch * | eis_device_touch_new (struct eis_device *device) |
see ei_device_touch_new More... | |
void | eis_touch_down (struct eis_touch *touch, double x, double y) |
see ei_touch_down More... | |
void | eis_touch_motion (struct eis_touch *touch, double x, double y) |
see ei_touch_motion More... | |
void | eis_touch_up (struct eis_touch *touch) |
see ei_touch_up More... | |
struct eis_touch * | eis_touch_ref (struct eis_touch *touch) |
see ei_touch_ref More... | |
struct eis_touch * | eis_touch_unref (struct eis_touch *touch) |
see ei_touch_unref More... | |
void | eis_touch_set_user_data (struct eis_touch *touch, void *user_data) |
see ei_touch_set_user_data More... | |
void * | eis_touch_get_user_data (struct eis_touch *touch) |
see ei_touch_get_user_data More... | |
struct eis_device * | eis_touch_get_device (struct eis_touch *touch) |
see ei_touch_get_device More... | |
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. More... | |
struct eis_device * | eis_event_get_device (struct eis_event *event) |
Return the device from this event. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
uint32_t | eis_event_pointer_get_button (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_BUTTON return the button code as defined in linux/input-event-codes.h. More... | |
bool | eis_event_pointer_get_button_is_press (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_BUTTON return true if the event is a button press, false for a release. More... | |
double | eis_event_pointer_get_scroll_x (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL return the x scroll distance in logical pixels or mm, depending on the device type. More... | |
double | eis_event_pointer_get_scroll_y (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL return the y scroll distance in logical pixels or mm, depending on the device type. More... | |
bool | eis_event_pointer_get_scroll_stop_x (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL_STOP return whether the x axis has stopped scrolling. More... | |
bool | eis_event_pointer_get_scroll_stop_y (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL_STOP return whether the y axis has stopped scrolling. More... | |
int32_t | eis_event_pointer_get_scroll_discrete_x (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL_DISCRETE return the x scroll distance in fractions or multiples of 120. More... | |
int32_t | eis_event_pointer_get_scroll_discrete_y (struct eis_event *event) |
For an event of type EIS_EVENT_POINTER_SCROLL_DISCRETE return the y scroll distance in fractions or multiples of 120. More... | |
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). More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
libeis is the server-side module.
This API should be used by processes that have control over input devices, e.g. Wayland compositors.
libei clients come in "sender" and "receiver" modes, depending on whether the client sends or receives events. A libeis context however may accept both sender and receiver clients, the EIS implementation works as corresponding receiver or sender for this client. It is up to the implementation to disconnect clients that it does not want to allow. See eis_client_is_sender() for details.
Note that usually the differentiation between sender and receiver client has an effect on the devices that should be sent to the client. Sender clients typically expect devices representing the available screen area so they can control input, receiver clients typically expect devices representing the physical input devices.
typedef void(* eis_log_handler) (struct eis *eis, enum eis_log_priority priority, const char *file, int lineno, const char *func, const char *message, bool is_continuation) |
The log handler for library logging.
This handler is only called for messages with a log level equal or greater than than the one set in eis_log_set_priority().
eis | The EIs context |
priority | The log priority |
file | The filename where this log message was triggered |
lineno | The line number in file where this log message was triggered |
func | The function name where this log message was triggered |
message | The log message as a null-terminated string |
is_continuation | The message is a continuation of the previous message. The caller should skip any per-line-based prefixes. |
enum eis_device_type |
The device type determines what the device represents.
If the device type is EIS_DEVICE_TYPE_VIRTUAL, the device is a virtual device representing input as applied on the EIS implementation's screen. A relative virtual device generates input events in logical pixels, an absolute virtual device generates input events in logical pixels on one of the device's regions. Virtual devices do not have a size.
If the device type is EIS_DEVICE_TYPE_PHYSICAL, the device is a representation of a physical device as if connected to the EIS implementation's host computer. A relative physical device generates input events in mm, an absolute physical device generates input events in mm within the device's specified physical size. Physical devices do not have regions.
Enumerator | |
---|---|
EIS_DEVICE_TYPE_VIRTUAL | |
EIS_DEVICE_TYPE_PHYSICAL |
enum eis_event_type |
enum eis_keymap_type |
enum eis_log_priority |
A set of masks for operations permitted on properties.
Note that property permissions only affect the libei client, the server has full access to the properties at any time.
Enumerator | |
---|---|
EIS_PROPERTY_PERM_NONE | |
EIS_PROPERTY_PERM_READ | |
EIS_PROPERTY_PERM_WRITE | |
EIS_PROPERTY_PERM_DELETE | |
EIS_PROPERTY_PERM_ALL |
int eis_backend_fd_add_client | ( | struct eis * | ctx | ) |
Add a new client to a context set up with eis_setup_backend_fd().
Returns a file descriptor to be passed to ei_setup_backend_fd(), or a negative errno on failure.
void eis_client_connect | ( | struct eis_client * | client | ) |
Allow connection from the client.
This can only be done once, further calls to this functions are ignored.
When receiving an event of type EIS_EVENT_CLIENT_CONNECT, the server should connect client as soon as possible to allow communication with the server. If the client is not authorized to talk to the server, call eis_client_disconnect().
void eis_client_disconnect | ( | struct eis_client * | client | ) |
Disconnect this client.
Once disconnected the client may no longer talk to this context, all resources associated with this client should be released.
It is not necessary to call this function when an EIS_EVENT_CLIENT_DISCONNECT event is received.
const char* eis_client_get_name | ( | struct eis_client * | client | ) |
Return the name set by this client.
The server is under no obligation to use this name.
void* eis_client_get_user_data | ( | struct eis_client * | eis_client | ) |
bool eis_client_is_sender | ( | struct eis_client * | client | ) |
Returns true if the client is a sender, false otherwise.
A sender client may send events to the EIS implementation, a receiver client expects to receive events from the EIS implementation.
struct eis_seat* eis_client_new_seat | ( | struct eis_client * | client, |
const char * | name | ||
) |
Create a new logical seat with a given name.
Devices available to a client belong to a bound seat, or in other words: a client cannot receive events from a device until it binds to a seat and receives all devices from that seat.
This seat is not immediately active, use eis_seat_add() to bind this seat on the client and notify the client of it's availability.
The returned seat is refcounted, use eis_seat_unref() to drop the reference.
const char* eis_client_property_get | ( | struct eis_client * | client, |
const char * | property | ||
) |
Return the value of the given property or NULL if the property is not set.
The following property names are automatically set by libei:
/proc/$pid/cmdline
of the libei process uint32_t eis_client_property_get_permissions | ( | struct eis_client * | client, |
const char * | propert | ||
) |
Return the permissions mask for the given property.
If the property does not exist, this function returns zero.
void eis_client_property_set | ( | struct eis_client * | client, |
const char * | property, | ||
const char * | value | ||
) |
See eis_client_property_set_with_permissions(), but the permissions are left as-is.
If the property does not exist, it is created with permissions EIS_PROPERTY_PERM_ALL.
void eis_client_property_set_with_permissions | ( | struct eis_client * | client, |
const char * | property, | ||
const char * | value, | ||
uint32_t | permission | ||
) |
Change, create or delete a property.
If the property is not deleted, the permissions are updated to the given permissions.
Properties should use a name in the form "namespace.name" or "namespace.name.subname". Two namespaces are reserved for use by this library: "eis.*" and "ei.*". Attempting to change a property within that namespace will be silently ignored.
struct eis_client* eis_client_ref | ( | struct eis_client * | client | ) |
void eis_client_set_user_data | ( | struct eis_client * | eis_client, |
void * | user_data | ||
) |
struct eis_client* eis_client_unref | ( | struct eis_client * | client | ) |
void eis_device_add | ( | struct eis_device * | device | ) |
Add this device to its seat and notify the client of the device's availability.
The device is paused, use eis_device_resume() to enable events from the client.
void eis_device_configure_capability | ( | struct eis_device * | device, |
enum eis_device_capability | cap | ||
) |
void eis_device_configure_name | ( | struct eis_device * | device, |
const char * | name | ||
) |
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.
Device with relative-only capabilities does not require a size. A device with capability EIS_DEVICE_CAP_POINTER_ABSOLUTE or EIS_DEVICE_CAP_TOUCH must have a size.
This function has no effect if called on a device of type other than EIS_DEVICE_TYPE_PHYSICAL.
This function has no effect if called after ei_device_add()
void eis_device_configure_type | ( | struct eis_device * | device, |
enum eis_device_type | type | ||
) |
Set the device type for this device.
It is recommended that that the device type is the first call to configure the device as the device type influences which other properties on the device can be set and/or will trigger warnings if invoked with wrong arguments.
void eis_device_frame | ( | struct eis_device * | device | ) |
see ei_device_frame
struct eis_client* eis_device_get_client | ( | struct eis_device * | device | ) |
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.
const char* eis_device_get_name | ( | struct eis_device * | device | ) |
Return the name of the device.
The return value of this function may change after eis_device_configure_name(), a caller should keep a copy of it where required rather than the pointer value.
struct eis_region* eis_device_get_region | ( | struct eis_device * | device, |
size_t | index | ||
) |
Obtain a region from the device.
This function only returns regions that have been added to the device with eis_region_add(). The number of regions is constant for a device once eis_device_add() has been called and the indices of any region remains the same for the lifetime of the device.
Regions are shared between all capabilities. Where two capabilities need different region, the EIS implementation must create multiple devices with individual capabilities and regions.
This function returns the given region or NULL if the index is larger than the number of regions available.
This does not increase the refcount of the region. Use eis_region_ref() to keep a reference beyond the immediate scope.
struct eis_seat* eis_device_get_seat | ( | struct eis_device * | device | ) |
enum eis_device_type eis_device_get_type | ( | struct eis_device * | device | ) |
void* eis_device_get_user_data | ( | struct eis_device * | eis_device | ) |
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.
bool eis_device_has_capability | ( | struct eis_device * | device, |
enum eis_device_capability | cap | ||
) |
struct eis_keymap* eis_device_keyboard_get_keymap | ( | struct eis_device * | device | ) |
Return the keymap assigned to this device.
The return value of this function is the keymap (if any) after the call to eis_keymap_add().
void eis_device_keyboard_key | ( | struct eis_device * | device, |
uint32_t | keycode, | ||
bool | is_press | ||
) |
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.
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.
This keymap does not immediately apply to the device, use eis_keymap_add() to apply this keymap. A keymap may only be applied once and to a single device.
The returned keymap has a refcount of at least 1, use eis_keymap_unref() to release resources associated with this keymap.
device | The device with a EIS_DEVICE_CAP_KEYBOARD capability |
type | The type of the keymap. |
fd | A memmap-able file descriptor of size size pointing to the keymap used by this device. fd can be closed by the caller after this function completes. The file descriptor needs to be mmap:ed with MAP_PRIVATE. |
size | The size of the data at fd in bytes |
NULL
on failure. 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.
Use eis_region_add() to properly add the region to the device.
A region must have a size to be valid, see eis_region_set_size().
For a device of type EIS_DEVICE_TYPE_PHYSICAL this function returns NULL.
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.
The library filters events sent by the client after the pause notification has been processed by the client but this does not affect events already in transit. In other words, the server may still receive a number of events from a device after it has been paused and must update its internal state accordingly.
Pause/resume should only be used for short-term event delaying, a client will expect that the device's state has not changed between pause and resume. Where a device's state changes on the EIS implementation side (e.g. buttons or keys are forcibly released), the device should be removed and re-added as new device.
device | A connected device |
void eis_device_pointer_button | ( | struct eis_device * | device, |
uint32_t | button, | ||
bool | is_press | ||
) |
void eis_device_pointer_motion | ( | struct eis_device * | device, |
double | x, | ||
double | y | ||
) |
void eis_device_pointer_motion_absolute | ( | struct eis_device * | device, |
double | x, | ||
double | y | ||
) |
void eis_device_pointer_scroll | ( | struct eis_device * | device, |
double | x, | ||
double | y | ||
) |
void eis_device_pointer_scroll_cancel | ( | struct eis_device * | device, |
bool | cancel_x, | ||
bool | cancel_y | ||
) |
void eis_device_pointer_scroll_discrete | ( | struct eis_device * | device, |
int32_t | x, | ||
int32_t | y | ||
) |
void eis_device_pointer_scroll_stop | ( | struct eis_device * | device, |
bool | stop_x, | ||
bool | stop_y | ||
) |
struct eis_device* eis_device_ref | ( | struct eis_device * | device | ) |
void eis_device_remove | ( | struct eis_device * | device | ) |
Remove the device.
This does not release any resources associated with this device, use eis_device_unref() for any references held by the caller.
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.
device | A connected device |
void eis_device_set_user_data | ( | struct eis_device * | eis_device, |
void * | user_data | ||
) |
void eis_device_start_emulating | ( | struct eis_device * | device | ) |
void eis_device_stop_emulating | ( | struct eis_device * | device | ) |
struct eis_touch* eis_device_touch_new | ( | struct eis_device * | device | ) |
struct eis_device* eis_device_unref | ( | struct eis_device * | device | ) |
void eis_dispatch | ( | struct eis * | eis | ) |
Main event dispatching function.
Reads events of the file descriptors and processes them internally. Use eis_get_event() to retrieve the events.
Dispatching does not necessarily queue events. This function should be called immediately once data is available on the file descriptor returned by eis_get_fd().
struct eis_client* eis_event_get_client | ( | struct eis_event * | event | ) |
struct eis_device* eis_event_get_device | ( | struct eis_event * | event | ) |
Return the device from this event.
This does not increase the refcount of the device. Use eis_device_ref() to keep a reference beyond the immediate scope.
struct eis_seat* eis_event_get_seat | ( | struct eis_event * | event | ) |
enum eis_event_type eis_event_get_type | ( | struct eis_event * | event | ) |
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.
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_pointer_get_button | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_BUTTON return the button code as defined in linux/input-event-codes.h.
bool eis_event_pointer_get_button_is_press | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_BUTTON return true if the event is a button press, false for a release.
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.
int32_t eis_event_pointer_get_scroll_discrete_x | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL_DISCRETE return the x scroll distance in fractions or multiples of 120.
int32_t eis_event_pointer_get_scroll_discrete_y | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL_DISCRETE return the y scroll distance in fractions or multiples of 120.
bool eis_event_pointer_get_scroll_stop_x | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL_STOP return whether the x axis has stopped scrolling.
For an event of type EIS_EVENT_POINTER_SCROLL_CANCEL return whether the x axis has cancelled scrolling.
bool eis_event_pointer_get_scroll_stop_y | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL_STOP return whether the y axis has stopped scrolling.
For an event of type EIS_EVENT_POINTER_SCROLL_CANCEL return whether the y axis has cancelled scrolling.
double eis_event_pointer_get_scroll_x | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL return the x scroll distance in logical pixels or mm, depending on the device type.
double eis_event_pointer_get_scroll_y | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_POINTER_SCROLL return the y scroll distance in logical pixels or mm, depending on the device type.
const char* eis_event_property_get_name | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the property name that has changed.
uint32_t eis_event_property_get_permissions | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the permissions of the property (at the time of the event).
const char* eis_event_property_get_value | ( | struct eis_event * | event | ) |
For an event of type EIS_EVENT_CLIENT_PROPERTY, get the new property value (at the time of the event).
A property value of NULL indicates the property has been deleted.
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.
This is the set of all capabilities bound by the client as of this event, not just the changed ones.
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.
The tracking ID is a unique identifier for a touch and is valid from touch down through to touch up but may be re-used in the future. The tracking ID is randomly assigned to a touch, a client must not expect any specific value.
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.
struct eis_event* eis_event_unref | ( | struct eis_event * | event | ) |
Release resources associated with this event.
This function always returns NULL.
The caller cannot increase the refcount of an event. Events should be considered transient data and not be held longer than required. eis_event_unref() is provided for consistency (as opposed to, say, eis_event_free()).
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.
The returned event is refcounted, use eis_event_unref() to drop the reference.
You must not call this function while holding a reference to an event returned by eis_peek_event().
int eis_get_fd | ( | struct eis * | eis | ) |
libeis keeps a single file descriptor for all events.
This fd should be monitored for events by the caller's mainloop, e.g. using select(). When events are available on this fd, call eis_dispatch() immediately to process.
void* eis_get_user_data | ( | struct eis * | eis | ) |
void eis_keymap_add | ( | struct eis_keymap * | keymap | ) |
Set the keymap on the device.
The keymap is constant for the lifetime of the device and assigned to this device individually. Where the keymap has to change, remove the device and create a new one.
If a keymap is NULL
, the device does not have an individual keymap assigned. Note that this may mean the client needs to guess at the keymap layout.
This function has no effect if called after eis_device_add()
struct eis_device* eis_keymap_get_device | ( | struct eis_keymap * | keymap | ) |
Return the device this keymap belongs to.
int eis_keymap_get_fd | ( | struct eis_keymap * | keymap | ) |
Return a memmap-able file descriptor pointing to the keymap used by the device.
The keymap is constant for the lifetime of the device and assigned to this device individually.
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.
The type specifies how to interpret the data at the file descriptor returned by eis_keymap_get_fd().
void* eis_keymap_get_user_data | ( | struct eis_keymap * | eis_keymap | ) |
struct eis_keymap* eis_keymap_ref | ( | struct eis_keymap * | keymap | ) |
void eis_keymap_set_user_data | ( | struct eis_keymap * | eis_keymap, |
void * | user_data | ||
) |
struct eis_keymap* eis_keymap_unref | ( | struct eis_keymap * | keymap | ) |
enum eis_log_priority eis_log_get_priority | ( | const struct eis * | eis | ) |
void eis_log_set_handler | ( | struct eis * | eis, |
eis_log_handler | log_handler | ||
) |
Change the log handler for this context.
If the log handler is NULL, the built-in default log function is used.
eis | The EIS context |
log_handler | The log handler or NULL to use the default log handler. |
void eis_log_set_priority | ( | struct eis * | eis, |
enum eis_log_priority | priority | ||
) |
struct eis* eis_new | ( | void * | user_data | ) |
Create a new libeis context with a refcount of 1.
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.
the next call to eis_get_event() will return that same event.
This call is useful for checking whether there is an event and/or what type of event it is.
Repeated calls to eis_peek_event() return the same event.
The returned event is refcounted, use eis_event_unref() to drop the reference.
A caller must not call eis_get_event() while holding a ref to an event returned by eis_peek_event().
struct eis* eis_ref | ( | struct eis * | eis | ) |
void eis_region_add | ( | struct eis_region * | region | ) |
Add the given region to its device.
Once added, the region will be sent to the client when the caller calls eis_device_add() later.
Adding the same region twice will be silently ignored.
uint32_t eis_region_get_height | ( | struct eis_region * | region | ) |
void* eis_region_get_user_data | ( | struct eis_region * | region | ) |
uint32_t eis_region_get_width | ( | struct eis_region * | region | ) |
uint32_t eis_region_get_x | ( | struct eis_region * | region | ) |
uint32_t eis_region_get_y | ( | struct eis_region * | region | ) |
struct eis_region* eis_region_ref | ( | struct eis_region * | region | ) |
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.
If unset, the scale defaults to 1.0.
A scale value of less or equal to 0.0 will be silently ignored.
This call has no effect if called after eis_region_add()
See ei_region_get_physical_scale() for details.
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_user_data | ( | struct eis_region * | region, |
void * | user_data | ||
) |
struct eis_region* eis_region_unref | ( | struct eis_region * | region | ) |
void eis_seat_add | ( | struct eis_seat * | seat | ) |
Add this seat to its client and notify the client of the seat's availability.
This allows the client to create a device within this seat.
void eis_seat_configure_capability | ( | struct eis_seat * | seat, |
enum eis_device_capability | cap | ||
) |
Allow a capability on the seat.
This indicates to the client that it may create devices with with the given capabilities, though the EIS implementation may restrict the of capabilities on a device to a subset of those in the seat, see eis_device_allow_capability().
This function must be called before eis_seat_add().
This function has no effect if called after eis_seat_add()
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 | ) |
bool eis_seat_has_capability | ( | struct eis_seat * | seat, |
enum eis_device_capability | cap | ||
) |
struct eis_device* eis_seat_new_device | ( | struct eis_seat * | seat | ) |
Create a new device on the seat.
This device is not immediately active, use eis_device_add() to notify the client of it's availability.
The returned device is refcounted, use eis_device_unref() to drop the reference.
Before calling eis_device_add(), use the following functions to set up the device:
The device type of the device defaults to EIS_DEVICE_TYPE_VIRTUAL.
struct eis_seat* eis_seat_ref | ( | struct eis_seat * | seat | ) |
void eis_seat_remove | ( | struct eis_seat * | seat | ) |
Remove this seat and all its remaining devices.
void eis_seat_set_user_data | ( | struct eis_seat * | eis_seat, |
void * | user_data | ||
) |
struct eis_seat* eis_seat_unref | ( | struct eis_seat * | seat | ) |
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 sockets.
int eis_setup_backend_socket | ( | struct eis * | ctx, |
const char * | path | ||
) |
Initialize the context with a UNIX socket name.
If the path does not start with / it is relative to $XDG_RUNTIME_DIR.
void eis_touch_down | ( | struct eis_touch * | touch, |
double | x, | ||
double | y | ||
) |
see ei_touch_down
struct eis_device* eis_touch_get_device | ( | struct eis_touch * | touch | ) |
void* eis_touch_get_user_data | ( | struct eis_touch * | touch | ) |
void eis_touch_motion | ( | struct eis_touch * | touch, |
double | x, | ||
double | y | ||
) |
see ei_touch_motion
struct eis_touch* eis_touch_ref | ( | struct eis_touch * | touch | ) |
see ei_touch_ref
void eis_touch_set_user_data | ( | struct eis_touch * | touch, |
void * | user_data | ||
) |
struct eis_touch* eis_touch_unref | ( | struct eis_touch * | touch | ) |
see ei_touch_unref
void eis_touch_up | ( | struct eis_touch * | touch | ) |
see ei_touch_up
struct eis* eis_unref | ( | struct eis * | eis | ) |