libei  1.5.0
A library for Emulated Input
libei.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Red Hat, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #pragma once
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include <stdbool.h>
32 #include <stdint.h>
33 #include <stddef.h>
34 
135 struct ei;
136 
148 struct ei_device;
149 
163 struct ei_seat;
164 
173 struct ei_event;
174 
182 struct ei_keymap;
183 
204 struct ei_region;
205 
216 struct ei_touch;
217 
226 struct ei_ping;
227 
253 };
254 
303 };
304 
315 };
316 
336 
350 
361 
373 
384 
396 
408 
448 
457 
468 
478 
502 
511 
520 
528 
559 
567 
594 };
595 
601 const char*
603 
607 struct ei *
608 ei_new(void *user_data);
609 
627 struct ei *
628 ei_new_sender(void *user_data);
629 
647 struct ei *
648 ei_new_receiver(void *user_data);
649 
656 struct ei *
657 ei_ref(struct ei *ei);
658 
666 struct ei *
667 ei_unref(struct ei *ei);
668 
674 void
675 ei_set_user_data(struct ei *ei, void *user_data);
676 
681 void *
682 ei_get_user_data(struct ei *ei);
683 
687 bool
688 ei_is_sender(struct ei *ei);
689 
698 };
699 
700 struct ei_log_context;
701 
706 unsigned int
707 ei_log_context_get_line(struct ei_log_context *ctx);
708 
713 const char *
714 ei_log_context_get_file(struct ei_log_context *ctx);
715 
720 const char *
721 ei_log_context_get_func(struct ei_log_context *ctx);
722 
740 typedef void (*ei_log_handler)(struct ei *ei,
741  enum ei_log_priority priority,
742  const char *message,
743  struct ei_log_context *context);
754 void
755 ei_log_set_handler(struct ei *ei, ei_log_handler log_handler);
756 
760 void
761 ei_log_set_priority(struct ei *ei, enum ei_log_priority priority);
762 
766 enum ei_log_priority
767 ei_log_get_priority(const struct ei *ei);
768 
777 typedef uint64_t (*ei_clock_now_func)(struct ei *ei);
778 
784 void
785 ei_clock_set_now_func(struct ei *, ei_clock_now_func func);
786 
799 void
800 ei_configure_name(struct ei * ei, const char *name);
801 
823 int
824 ei_setup_backend_fd(struct ei *ei, int fd);
825 
852 int
853 ei_setup_backend_socket(struct ei *ei, const char *socketpath);
854 
861 int
862 ei_get_fd(struct ei *ei);
863 
873 struct ei_ping *
874 ei_new_ping(struct ei *ei);
875 
888 uint64_t
889 ei_ping_get_id(struct ei_ping *ping);
890 
899 struct ei_ping *
900 ei_ping_ref(struct ei_ping *ei_ping);
901 
910 struct ei_ping *
911 ei_ping_unref(struct ei_ping *ei_ping);
912 
920 void
921 ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data);
922 
929 void *
931 
949 void
950 ei_ping(struct ei_ping *ping);
951 
961 void
962 ei_dispatch(struct ei *ei);
963 
970 struct ei_event *
971 ei_get_event(struct ei *ei);
972 
989 struct ei_event *
990 ei_peek_event(struct ei *ei);
991 
999 uint64_t
1000 ei_now(struct ei *ei);
1001 
1017 void
1018 ei_disconnect(struct ei *ei);
1019 
1027 void
1028 ei_seat_set_user_data(struct ei_seat *seat, void *user_data);
1029 
1036 void *
1037 ei_seat_get_user_data(struct ei_seat *seat);
1038 
1042 const char *
1043 ei_seat_get_name(struct ei_seat *seat);
1044 
1052 bool
1053 ei_seat_has_capability(struct ei_seat *seat,
1054  enum ei_device_capability cap);
1055 
1073 void
1074 ei_seat_bind_capabilities(struct ei_seat *seat, ...)
1075 __attribute__((sentinel));
1076 
1088 void
1089 ei_seat_unbind_capabilities(struct ei_seat *seat, ...)
1090 __attribute__((sentinel));
1091 
1092 
1096 struct ei_seat *
1097 ei_seat_ref(struct ei_seat *seat);
1098 
1102 struct ei_seat *
1103 ei_seat_unref(struct ei_seat *seat);
1104 
1110 struct ei *
1111 ei_seat_get_context(struct ei_seat *seat);
1112 
1121 struct ei_event *
1122 ei_event_ref(struct ei_event *event);
1123 
1133 struct ei_event *
1134 ei_event_unref(struct ei_event *event);
1135 
1139 enum ei_event_type
1140 ei_event_get_type(struct ei_event *event);
1141 
1151 struct ei_device *
1152 ei_event_get_device(struct ei_event *event);
1153 
1163 uint64_t
1164 ei_event_get_time(struct ei_event *event);
1165 
1174 struct ei_device *
1175 ei_device_ref(struct ei_device *device);
1176 
1185 struct ei_device *
1186 ei_device_unref(struct ei_device *device);
1187 
1191 struct ei_seat *
1192 ei_device_get_seat(struct ei_device *device);
1193 
1201 void
1202 ei_device_set_user_data(struct ei_device *device, void *user_data);
1203 
1210 void *
1211 ei_device_get_user_data(struct ei_device *device);
1212 
1219 uint32_t
1220 ei_device_get_width(struct ei_device *device);
1221 
1228 uint32_t
1229 ei_device_get_height(struct ei_device *device);
1230 
1236 size_t
1237 ei_keymap_get_size(struct ei_keymap *keymap);
1238 
1245 enum ei_keymap_type
1246 ei_keymap_get_type(struct ei_keymap *keymap);
1247 
1255 int
1256 ei_keymap_get_fd(struct ei_keymap *keymap);
1257 
1268 struct ei_device *
1269 ei_keymap_get_device(struct ei_keymap *keymap);
1270 
1279 struct ei_keymap *
1280 ei_keymap_ref(struct ei_keymap *keymap);
1281 
1290 struct ei_keymap *
1291 ei_keymap_unref(struct ei_keymap *keymap);
1292 
1296 void
1297 ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data);
1298 
1302 void *
1303 ei_keymap_get_user_data(struct ei_keymap *keymap);
1304 
1324 void
1325 ei_device_close(struct ei_device *device);
1326 
1332 const char *
1333 ei_device_get_name(struct ei_device *device);
1334 
1340 enum ei_device_type
1341 ei_device_get_type(struct ei_device *device);
1342 
1350 bool
1351 ei_device_has_capability(struct ei_device *device,
1352  enum ei_device_capability cap);
1353 
1354 
1376 struct ei_region *
1377 ei_device_get_region(struct ei_device *device, size_t index);
1378 
1387 struct ei_region *
1388 ei_device_get_region_at(struct ei_device *device, double x, double y);
1389 
1393 struct ei_region *
1394 ei_region_ref(struct ei_region *region);
1395 
1399 struct ei_region *
1400 ei_region_unref(struct ei_region *region);
1401 
1405 void
1406 ei_region_set_user_data(struct ei_region *region, void *user_data);
1407 
1411 void *
1412 ei_region_get_user_data(struct ei_region *region);
1413 
1417 uint32_t
1418 ei_region_get_x(struct ei_region *region);
1419 
1423 uint32_t
1424 ei_region_get_y(struct ei_region *region);
1425 
1429 uint32_t
1430 ei_region_get_width(struct ei_region *region);
1431 
1435 uint32_t
1436 ei_region_get_height(struct ei_region *region);
1437 
1465 const char *
1466 ei_region_get_mapping_id(struct ei_region *region);
1467 
1474 bool
1475 ei_region_contains(struct ei_region *region, double x, double y);
1476 
1487 bool
1488 ei_region_convert_point(struct ei_region *region, double *x, double *y);
1489 
1559 double
1560 ei_region_get_physical_scale(struct ei_region *region);
1561 
1576 /* FIXME: the current API makes it impossible to know when the keymap has
1577  * been consumed so the file stays open forever.
1578  */
1579 struct ei_keymap *
1581 
1587 struct ei_device *
1588 ei_keymap_get_context(struct ei_keymap *keymap);
1589 
1595 struct ei *
1596 ei_device_get_context(struct ei_device *device);
1597 
1627 void
1628 ei_device_start_emulating(struct ei_device *device, uint32_t sequence);
1629 
1642 void
1643 ei_device_stop_emulating(struct ei_device *device);
1644 
1661 void
1662 ei_device_frame(struct ei_device *device, uint64_t time);
1663 
1676 void
1677 ei_device_pointer_motion(struct ei_device *device, double x, double y);
1678 
1694 void
1696  double x, double y);
1697 
1712 void
1713 ei_device_button_button(struct ei_device *device,
1714  uint32_t button, bool is_press);
1715 
1734 void
1735 ei_device_scroll_delta(struct ei_device *device, double x, double y);
1736 
1759 void
1760 ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
1761 
1791 void
1792 ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
1793 
1822 void
1823 ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
1824 
1845 void
1846 ei_device_keyboard_key(struct ei_device *device, uint32_t keycode, bool is_press);
1847 
1860 struct ei_touch *
1861 ei_device_touch_new(struct ei_device *device);
1862 
1876 void
1877 ei_touch_down(struct ei_touch *touch, double x, double y);
1878 
1884 void
1885 ei_touch_motion(struct ei_touch *touch, double x, double y);
1886 
1894 void
1895 ei_touch_up(struct ei_touch *touch);
1896 
1908 void
1909 ei_touch_cancel(struct ei_touch *touch);
1910 
1919 struct ei_touch *
1920 ei_touch_ref(struct ei_touch *touch);
1921 
1930 struct ei_touch *
1931 ei_touch_unref(struct ei_touch *touch);
1932 
1940 void
1941 ei_touch_set_user_data(struct ei_touch *touch, void *user_data);
1942 
1949 void *
1950 ei_touch_get_user_data(struct ei_touch *touch);
1951 
1957 struct ei_device *
1958 ei_touch_get_device(struct ei_touch *touch);
1959 
1969 struct ei_seat *
1970 ei_event_get_seat(struct ei_event *event);
1971 
1981 struct ei_ping *
1982 ei_event_pong_get_ping(struct ei_event *event);
1983 
1992 uint32_t
1994 
2002 uint32_t
2004 
2012 uint32_t
2014 
2022 uint32_t
2024 
2045 uint32_t
2047 
2048 
2055 double
2056 ei_event_pointer_get_dx(struct ei_event *event);
2057 
2064 double
2065 ei_event_pointer_get_dy(struct ei_event *event);
2066 
2073 double
2075 
2082 double
2084 
2091 uint32_t
2092 ei_event_button_get_button(struct ei_event *event);
2093 
2100 bool
2101 ei_event_button_get_is_press(struct ei_event *event);
2102 
2109 double
2110 ei_event_scroll_get_dx(struct ei_event *event);
2111 
2118 double
2119 ei_event_scroll_get_dy(struct ei_event *event);
2120 
2127 bool
2128 ei_event_scroll_get_stop_x(struct ei_event *event);
2129 
2136 bool
2137 ei_event_scroll_get_stop_y(struct ei_event *event);
2138 
2145 int32_t
2147 
2154 int32_t
2156 
2163 uint32_t
2164 ei_event_keyboard_get_key(struct ei_event *event);
2165 
2172 bool
2174 
2187 uint32_t
2188 ei_event_touch_get_id(struct ei_event *event);
2189 
2197 double
2198 ei_event_touch_get_x(struct ei_event *event);
2199 
2207 double
2208 ei_event_touch_get_y(struct ei_event *event);
2209 
2220 bool
2221 ei_event_touch_get_is_cancel(struct ei_event *event);
2222 
2227 #ifdef __cplusplus
2228 }
2229 #endif
bool ei_seat_has_capability(struct ei_seat *seat, enum ei_device_capability cap)
Return true if the capability is available on this seat or false otherwise.
void ei_region_set_user_data(struct ei_region *region, void *user_data)
void ei_touch_down(struct ei_touch *touch, double x, double y)
This function can only be called once on an ei_touch object.
void ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y)
Generate a scroll stop event on a device with the EI_DEVICE_CAP_SCROLL capability.
struct ei_touch * ei_touch_ref(struct ei_touch *touch)
Increase the refcount of this struct by one.
size_t ei_keymap_get_size(struct ei_keymap *keymap)
struct ei_keymap * ei_keymap_ref(struct ei_keymap *keymap)
Increase the refcount of this struct by one.
void * ei_device_get_user_data(struct ei_device *device)
Return the custom data pointer for this context.
uint32_t ei_event_keyboard_get_xkb_mods_depressed(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically pressed-down mo...
int ei_keymap_get_fd(struct ei_keymap *keymap)
Return a memmap-able file descriptor pointing to the keymap used by the device.
A rectangular region, defined by an x/y offset and a width and a height.
Definition: libei.h:182
struct ei_ping * ei_ping_ref(struct ei_ping *ei_ping)
Increase the refcount of this struct by one.
void * ei_ping_get_user_data(struct ei_ping *ei_ping)
Return the custom data pointer for this struct.
double ei_event_scroll_get_dx(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DELTA return the x scroll distance in logical pixels or mm...
struct ei_device * ei_device_unref(struct ei_device *device)
Decrease the refcount of this struct by one.
void ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y)
Generate a scroll cancel event on a device with the EI_DEVICE_CAP_SCROLL capability.
enum ei_keymap_type ei_keymap_get_type(struct ei_keymap *keymap)
Returns the type for this keymap.
"Hardware" frame event.
Definition: libei.h:477
void ei_ping(struct ei_ping *ping)
Issue a roundtrip request to the EIS implementation, resulting in an EI_EVENT_PONG event when this ro...
void ei_device_close(struct ei_device *device)
Notify the server that the client is no longer interested in this device.
int ei_setup_backend_socket(struct ei *ei, const char *socketpath)
Set this ei context to use the socket backend.
This event represents a synchronization request (ping) from the EIS implementation.
Definition: libei.h:467
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps...
Definition: libei.h:558
ei_log_priority
Definition: libei.h:693
bool ei_event_touch_get_is_cancel(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_UP return true if the event was cancelled instead of logically re...
void ei_touch_up(struct ei_touch *touch)
Release this touch.
bool ei_event_button_get_is_press(struct ei_event *event)
For an event of type EI_EVENT_BUTTON_BUTTON return true if the event is a button press, false for a release.
struct ei_seat * ei_event_get_seat(struct ei_event *event)
Return the seat from this event.
struct ei_region * ei_region_unref(struct ei_region *region)
void ei_log_set_handler(struct ei *ei, ei_log_handler log_handler)
Change the log handler for this context.
const char * ei_log_context_get_func(struct ei_log_context *ctx)
struct ei * ei_new_sender(void *user_data)
Create a new sender ei context.
The server has removed a seat previously available to this client.
Definition: libei.h:372
double ei_event_touch_get_x(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, or EI_EVENT_TOUCH_MOTION, return the x coordinate of the to...
bool ei_event_keyboard_get_key_is_press(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_KEY return true if the event is a key down, false for a release.
uint32_t ei_event_emulating_get_sequence(struct ei_event *event)
For an event of type EI_EVENT_DEVICE_START_EMULATING, return the sequence number set by the EIS imple...
struct ei_seat * ei_device_get_seat(struct ei_device *device)
Event for a single touch released from the device's logical surface.
Definition: libei.h:585
bool ei_device_has_capability(struct ei_device *device, enum ei_device_capability cap)
Return true if the device has the requested capability.
uint64_t ei_now(struct ei *ei)
double ei_event_scroll_get_dy(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DELTA return the y scroll distance in logical pixels or mm...
double ei_event_pointer_get_absolute_x(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION_ABSOLUTE return the x position in logical pixels or mm...
A button press or release event.
Definition: libei.h:527
uint64_t(* ei_clock_now_func)(struct ei *ei)
Optional override function for ei_now().
Definition: libei.h:777
struct ei_seat * ei_seat_unref(struct ei_seat *seat)
The device can send relative motion events.
Definition: libei.h:282
int ei_setup_backend_fd(struct ei *ei, int fd)
Initialize the ei context on the given socket file descriptor.
void ei_touch_set_user_data(struct ei_touch *touch, void *user_data)
Set a custom data pointer for this context.
uint32_t ei_event_button_get_button(struct ei_event *event)
For an event of type EI_EVENT_BUTTON_BUTTON return the button code as defined in linux/input-event-co...
Event for a single touch set down on the device's logical surface.
Definition: libei.h:577
struct ei_region * ei_device_get_region_at(struct ei_device *device, double x, double y)
Return the region that contains the given point x/y (in desktop-wide coordinates) or NULL if the coor...
The server stopped emulating events on this device, see EIS_EVENT_DEVICE_START_EMULATING.
Definition: libei.h:501
void ei_device_set_user_data(struct ei_device *device, void *user_data)
Set a custom data pointer for this context.
enum ei_event_type ei_event_get_type(struct ei_event *event)
double ei_event_pointer_get_dx(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION return the relative x movement in logical pixels or mm...
uint32_t ei_event_keyboard_get_xkb_group(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the current effective group.
void ei_touch_motion(struct ei_touch *touch, double x, double y)
Move this touch to the new coordinates.
Definition: libei.h:251
The device can send scroll events.
Definition: libei.h:298
void * ei_get_user_data(struct ei *ei)
Return the custom data pointer for this context.
struct ei * ei_unref(struct ei *ei)
Decrease the refcount of this struct by one.
const char * ei_event_type_to_string(enum ei_event_type)
This is a debugging helper to return a string of the name of the event type, or NULL if the event typ...
void ei_device_start_emulating(struct ei_device *device, uint32_t sequence)
Notify the EIS implementation that the given device is about to start sending events.
void * ei_touch_get_user_data(struct ei_touch *touch)
Return the custom data pointer for this context.
Definition: libei.h:696
struct ei * ei_new(void *user_data)
This is an alias for ei_new_sender.
uint32_t ei_device_get_height(struct ei_device *device)
Return the height of the device in mm if the device is of type EI_DEVICE_TYPE_PHYSICAL, otherwise zero.
void ei_clock_set_now_func(struct ei *, ei_clock_now_func func)
Override the function that returns the current time ei_now().
Definition: libei.h:694
struct ei_event * ei_peek_event(struct ei *ei)
Returns the next event in the internal event queue (or NULL) without removing that event from the que...
uint64_t ei_ping_get_id(struct ei_ping *ping)
Return a unique, increasing id for this struct.
void ei_device_stop_emulating(struct ei_device *device)
Notify the EIS implementation that the given device is no longer sending events.
The device can send button events.
Definition: libei.h:302
struct ei_event * ei_get_event(struct ei *ei)
Return the next event from the event queue, removing it from the queue.
The server has added a device for this client.
Definition: libei.h:383
A libxkbcommon-compatible XKB keymap.
Definition: libei.h:314
The server has removed a device belonging to this client.
Definition: libei.h:395
uint32_t ei_region_get_y(struct ei_region *region)
A callback struct returned by ei_new_ping() to handle roundtrips to the EIS implementation.
Definition: libei.h:216
uint32_t ei_event_keyboard_get_key(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_KEY return the key code (as defined in include/linux/input-eve...
struct ei_device * ei_event_get_device(struct ei_event *event)
Return the device from this event.
bool ei_is_sender(struct ei *ei)
Returns true if the context is was created with ei_new_sender() or false otherwise.
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.
bool ei_region_convert_point(struct ei_region *region, double *x, double *y)
Convert the point x/y in a desktop-wide coordinate system into the corresponding point relative to th...
void * ei_region_get_user_data(struct ei_region *region)
struct ei_ping * ei_event_pong_get_ping(struct ei_event *event)
Returns the associated ei_ping struct with this event.
const char * ei_device_get_name(struct ei_device *device)
A single device to generate input events from.
Definition: libei.h:135
void ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data)
Set a custom data pointer for this struct.
The device can send absolute motion events.
Definition: libei.h:286
ei_device_type
The device type determines what the device represents.
Definition: libei.h:250
enum ei_log_priority ei_log_get_priority(const struct ei *ei)
void(* ei_log_handler)(struct ei *ei, enum ei_log_priority priority, const char *message, struct ei_log_context *context)
The log handler for library logging.
Definition: libei.h:740
The server has changed the modifier state on the device's keymap.
Definition: libei.h:447
void ei_disconnect(struct ei *ei)
Disconnect the current ei context from the EIS implementation.
The device can send touch events.
Definition: libei.h:294
void ei_device_button_button(struct ei_device *device, uint32_t button, bool is_press)
Generate a button event on a device with the EI_DEVICE_CAP_BUTTON capability.
void ei_log_set_priority(struct ei *ei, enum ei_log_priority priority)
An keymap for a device with the EI_DEVICE_CAP_KEYBOARD capability.
Definition: libei.h:173
struct ei_ping * ei_ping_unref(struct ei_ping *ei_ping)
Decrease the refcount of this struct by one.
The server has added a seat available to this client.
Definition: libei.h:360
struct ei * ei_device_get_context(struct ei_device *device)
Return the struct ei context this device is associated with.
The main context to interact with libei.
Definition: libei.h:697
uint32_t ei_region_get_x(struct ei_region *region)
struct ei_seat * ei_seat_ref(struct ei_seat *seat)
A single touch initiated by a sender context.
Definition: libei.h:204
const char * ei_log_context_get_file(struct ei_log_context *ctx)
uint64_t ei_event_get_time(struct ei_event *event)
Return the time for the event of type EI_EVENT_FRAME in microseconds.
ei_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition: libei.h:326
double ei_region_get_physical_scale(struct ei_region *region)
Return the physical scale for this region.
struct ei_keymap * ei_device_keyboard_get_keymap(struct ei_device *device)
Return the keymap for this device or NULL.
int32_t ei_event_scroll_get_discrete_dy(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DISCRETE return the y scroll distance in fractions or multiples ...
A logical seat for a group of devices.
Definition: libei.h:148
struct ei_event * ei_event_unref(struct ei_event *event)
Decrease the refcount of this struct by one.
struct ei * ei_ref(struct ei *ei)
Increase the refcount of this struct by one.
void * ei_keymap_get_user_data(struct ei_keymap *keymap)
An ongoing scroll sequence stopped.
Definition: libei.h:543
uint32_t ei_event_keyboard_get_xkb_mods_latched(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically latched modifie...
void ei_device_frame(struct ei_device *device, uint64_t time)
Generate a frame event to group the current set of events into a logical hardware event...
struct ei_device * ei_touch_get_device(struct ei_touch *touch)
A vertical and/or horizontal scroll event with logical-pixels or mm precision, depending on the devic...
Definition: libei.h:536
struct ei_region * ei_region_ref(struct ei_region *region)
void ei_device_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_SCROLL capability.
void ei_dispatch(struct ei *ei)
Main event dispatching function.
The server has disconnected this client - all resources left to reference this server are now obsolet...
Definition: libei.h:349
ei_device_capability
The set of supported capabilities.
Definition: libei.h:278
uint32_t ei_region_get_height(struct ei_region *region)
bool ei_event_scroll_get_stop_y(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_STOP return whether the y axis has stopped scrolling.
The server has approved the connection to this client.
Definition: libei.h:335
unsigned int ei_log_context_get_line(struct ei_log_context *ctx)
bool ei_event_scroll_get_stop_x(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_CANCEL return whether the x axis has cancelled scrolling...
struct ei_keymap * ei_keymap_unref(struct ei_keymap *keymap)
Decrease the refcount of this struct by one.
Any events sent from this device will be discarded until the next resume.
Definition: libei.h:403
The server is about to send events for a device.
Definition: libei.h:493
Event for a single currently-down touch changing position (or other properties).
Definition: libei.h:593
An ongoing scroll sequence was cancelled.
Definition: libei.h:550
void ei_set_user_data(struct ei *ei, void *user_data)
Set a custom data pointer for this context.
double ei_event_pointer_get_dy(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION return the relative y movement in logical pixels or mm...
int32_t ei_event_scroll_get_discrete_dx(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DISCRETE return the x scroll distance in fractions or multiples ...
const char * ei_region_get_mapping_id(struct ei_region *region)
Get the unique identifier (representing an external resource) that is attached to this region...
struct ei_ping * ei_new_ping(struct ei *ei)
Create a new ei_ping object to trigger a round trip to the EIS implementation.
double ei_event_touch_get_y(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, or EI_EVENT_TOUCH_MOTION, return the y coordinate of the to...
struct ei_event * ei_event_ref(struct ei_event *event)
Increase the refcount of this struct by one.
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.
int ei_get_fd(struct ei *ei)
libei keeps a single file descriptor for all events.
uint32_t ei_region_get_width(struct ei_region *region)
struct ei * ei_new_receiver(void *user_data)
Create a new receiver ei context.
void ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data)
Definition: libei.h:695
struct ei_device * ei_device_ref(struct ei_device *device)
Increase the refcount of this struct by one.
bool ei_region_contains(struct ei_region *region, double x, double y)
Return true if the point x/y (in desktop-wide coordinates) is within region.
void ei_seat_bind_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Bind this client to the given seat capabilities, terminated by NULL.
An absolute motion event with absolute position within the device's regions or size, depending on the device type.
Definition: libei.h:519
struct ei_device * ei_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...
The client may send events.
Definition: libei.h:407
struct ei_region * ei_device_get_region(struct ei_device *device, size_t index)
Obtain a region from a device of type EI_DEVICE_TYPE_VIRTUAL.
uint32_t ei_event_touch_get_id(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, EI_EVENT_TOUCH_MOTION, or EI_EVENT_TOUCH_UP, return the tracking ID of the touch.
void ei_touch_cancel(struct ei_touch *touch)
Cancel this touch.
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...
struct ei_touch * ei_touch_unref(struct ei_touch *touch)
Decrease the refcount of this struct by one.
void ei_seat_set_user_data(struct ei_seat *seat, void *user_data)
Set a custom data pointer for this context.
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.
uint32_t ei_event_keyboard_get_xkb_mods_locked(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically locked modifier...
const char * ei_seat_get_name(struct ei_seat *seat)
A key press or release event.
Definition: libei.h:566
Returned in response to ei_ping().
Definition: libei.h:456
void ei_device_scroll_delta(struct ei_device *device, double x, double y)
Generate a smooth (pixel-precise) scroll event on a device with the EI_DEVICE_CAP_SCROLL capability...
Definition: libei.h:252
void * ei_seat_get_user_data(struct ei_seat *seat)
Return the custom data pointer for this context.
The device can send keyboard events.
Definition: libei.h:290
uint32_t ei_device_get_width(struct ei_device *device)
Return the width of the device in mm if the device is of type EI_DEVICE_TYPE_PHYSICAL, otherwise zero.
A relative motion event with delta coordinates in logical pixels or mm, depending on the device type...
Definition: libei.h:510
void ei_seat_unbind_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Unbind a seat's capabilities, terminated by NULL.
void ei_configure_name(struct ei *ei, const char *name)
Set the name for this client.
An event received from the EIS implementation.
Definition: libei.h:163
double ei_event_pointer_get_absolute_y(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION_ABSOLUTE return the y position in logical pixels or mm...
enum ei_device_type ei_device_get_type(struct ei_device *device)
struct ei * ei_seat_get_context(struct ei_seat *seat)
Return the struct ei context this seat is associated with.
struct ei_device * ei_keymap_get_context(struct ei_keymap *keymap)
Return the struct ei_device this keymap is associated with.
ei_keymap_type
The set of supported keymap types for a struct ei_keymap.
Definition: libei.h:310