libei  1.6.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 <stddef.h>
33 #include <stdint.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 
251 
305  EI_DEVICE_CAP_TEXT = (1 << 6),
306 };
307 
318 };
319 
339 
353 
364 
376 
387 
399 
414 
422 
462 
471 
482 
492 
516 
525 
534 
542 
573 
581 
608 
620 
630 };
631 
637 const char *ei_event_type_to_string(enum ei_event_type);
638 
642 struct ei *
643 ei_new(void *user_data);
644 
662 struct ei *
663 ei_new_sender(void *user_data);
664 
682 struct ei *
683 ei_new_receiver(void *user_data);
684 
691 struct ei *
692 ei_ref(struct ei *ei);
693 
701 struct ei *
702 ei_unref(struct ei *ei);
703 
709 void
710 ei_set_user_data(struct ei *ei, void *user_data);
711 
716 void *
717 ei_get_user_data(struct ei *ei);
718 
722 bool
723 ei_is_sender(struct ei *ei);
724 
733 };
734 
735 struct ei_log_context;
736 
741 unsigned int
742 ei_log_context_get_line(struct ei_log_context *ctx);
743 
748 const char *
749 ei_log_context_get_file(struct ei_log_context *ctx);
750 
755 const char *
756 ei_log_context_get_func(struct ei_log_context *ctx);
757 
775 typedef void (*ei_log_handler)(struct ei *ei,
776  enum ei_log_priority priority,
777  const char *message,
778  struct ei_log_context *context);
789 void
790 ei_log_set_handler(struct ei *ei, ei_log_handler log_handler);
791 
795 void
796 ei_log_set_priority(struct ei *ei, enum ei_log_priority priority);
797 
801 enum ei_log_priority
802 ei_log_get_priority(const struct ei *ei);
803 
812 typedef uint64_t (*ei_clock_now_func)(struct ei *ei);
813 
819 void
820 ei_clock_set_now_func(struct ei *, ei_clock_now_func func);
821 
834 void
835 ei_configure_name(struct ei *ei, const char *name);
836 
858 int
859 ei_setup_backend_fd(struct ei *ei, int fd);
860 
887 int
888 ei_setup_backend_socket(struct ei *ei, const char *socketpath);
889 
896 int
897 ei_get_fd(struct ei *ei);
898 
908 struct ei_ping *
909 ei_new_ping(struct ei *ei);
910 
923 uint64_t
924 ei_ping_get_id(struct ei_ping *ping);
925 
934 struct ei_ping *
935 ei_ping_ref(struct ei_ping *ei_ping);
936 
945 struct ei_ping *
946 ei_ping_unref(struct ei_ping *ei_ping);
947 
955 void
956 ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data);
957 
964 void *
966 
984 void
985 ei_ping(struct ei_ping *ping);
986 
996 void
997 ei_dispatch(struct ei *ei);
998 
1005 struct ei_event *
1006 ei_get_event(struct ei *ei);
1007 
1024 struct ei_event *
1025 ei_peek_event(struct ei *ei);
1026 
1034 uint64_t
1035 ei_now(struct ei *ei);
1036 
1052 void
1053 ei_disconnect(struct ei *ei);
1054 
1062 void
1063 ei_seat_set_user_data(struct ei_seat *seat, void *user_data);
1064 
1071 void *
1072 ei_seat_get_user_data(struct ei_seat *seat);
1073 
1077 const char *
1078 ei_seat_get_name(struct ei_seat *seat);
1079 
1087 bool
1088 ei_seat_has_capability(struct ei_seat *seat, enum ei_device_capability cap);
1089 
1107 void
1108 ei_seat_bind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1109 
1121 void
1122 ei_seat_unbind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1123 
1148 void
1149 ei_seat_request_device_with_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1150 
1154 struct ei_seat *
1155 ei_seat_ref(struct ei_seat *seat);
1156 
1160 struct ei_seat *
1161 ei_seat_unref(struct ei_seat *seat);
1162 
1168 struct ei *
1169 ei_seat_get_context(struct ei_seat *seat);
1170 
1179 struct ei_event *
1180 ei_event_ref(struct ei_event *event);
1181 
1191 struct ei_event *
1192 ei_event_unref(struct ei_event *event);
1193 
1197 enum ei_event_type
1198 ei_event_get_type(struct ei_event *event);
1199 
1209 struct ei_device *
1210 ei_event_get_device(struct ei_event *event);
1211 
1221 uint64_t
1222 ei_event_get_time(struct ei_event *event);
1223 
1232 struct ei_device *
1233 ei_device_ref(struct ei_device *device);
1234 
1243 struct ei_device *
1244 ei_device_unref(struct ei_device *device);
1245 
1249 struct ei_seat *
1250 ei_device_get_seat(struct ei_device *device);
1251 
1259 void
1260 ei_device_set_user_data(struct ei_device *device, void *user_data);
1261 
1268 void *
1269 ei_device_get_user_data(struct ei_device *device);
1270 
1277 uint32_t
1278 ei_device_get_width(struct ei_device *device);
1279 
1286 uint32_t
1287 ei_device_get_height(struct ei_device *device);
1288 
1294 size_t
1295 ei_keymap_get_size(struct ei_keymap *keymap);
1296 
1303 enum ei_keymap_type
1304 ei_keymap_get_type(struct ei_keymap *keymap);
1305 
1313 int
1314 ei_keymap_get_fd(struct ei_keymap *keymap);
1315 
1326 struct ei_device *
1327 ei_keymap_get_device(struct ei_keymap *keymap);
1328 
1337 struct ei_keymap *
1338 ei_keymap_ref(struct ei_keymap *keymap);
1339 
1348 struct ei_keymap *
1349 ei_keymap_unref(struct ei_keymap *keymap);
1350 
1354 void
1355 ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data);
1356 
1360 void *
1361 ei_keymap_get_user_data(struct ei_keymap *keymap);
1362 
1382 void
1383 ei_device_close(struct ei_device *device);
1384 
1390 const char *
1391 ei_device_get_name(struct ei_device *device);
1392 
1398 enum ei_device_type
1399 ei_device_get_type(struct ei_device *device);
1400 
1408 bool
1409 ei_device_has_capability(struct ei_device *device, enum ei_device_capability cap);
1410 
1432 struct ei_region *
1433 ei_device_get_region(struct ei_device *device, size_t index);
1434 
1443 struct ei_region *
1444 ei_device_get_region_at(struct ei_device *device, double x, double y);
1445 
1449 struct ei_region *
1450 ei_region_ref(struct ei_region *region);
1451 
1455 struct ei_region *
1456 ei_region_unref(struct ei_region *region);
1457 
1461 void
1462 ei_region_set_user_data(struct ei_region *region, void *user_data);
1463 
1467 void *
1468 ei_region_get_user_data(struct ei_region *region);
1469 
1473 uint32_t
1474 ei_region_get_x(struct ei_region *region);
1475 
1479 uint32_t
1480 ei_region_get_y(struct ei_region *region);
1481 
1485 uint32_t
1486 ei_region_get_width(struct ei_region *region);
1487 
1491 uint32_t
1492 ei_region_get_height(struct ei_region *region);
1493 
1521 const char *
1522 ei_region_get_mapping_id(struct ei_region *region);
1523 
1530 bool
1531 ei_region_contains(struct ei_region *region, double x, double y);
1532 
1543 bool
1544 ei_region_convert_point(struct ei_region *region, double *x, double *y);
1545 
1615 double
1616 ei_region_get_physical_scale(struct ei_region *region);
1617 
1632 /* FIXME: the current API makes it impossible to know when the keymap has
1633  * been consumed so the file stays open forever.
1634  */
1635 struct ei_keymap *
1637 
1643 struct ei_device *
1644 ei_keymap_get_context(struct ei_keymap *keymap);
1645 
1651 struct ei *
1652 ei_device_get_context(struct ei_device *device);
1653 
1683 void
1684 ei_device_start_emulating(struct ei_device *device, uint32_t sequence);
1685 
1698 void
1699 ei_device_stop_emulating(struct ei_device *device);
1700 
1717 void
1718 ei_device_frame(struct ei_device *device, uint64_t time);
1719 
1732 void
1733 ei_device_pointer_motion(struct ei_device *device, double x, double y);
1734 
1750 void
1751 ei_device_pointer_motion_absolute(struct ei_device *device, double x, double y);
1752 
1767 void
1768 ei_device_button_button(struct ei_device *device, uint32_t button, bool is_press);
1769 
1788 void
1789 ei_device_scroll_delta(struct ei_device *device, double x, double y);
1790 
1813 void
1814 ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
1815 
1845 void
1846 ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
1847 
1876 void
1877 ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
1878 
1899 void
1900 ei_device_keyboard_key(struct ei_device *device, uint32_t keycode, bool is_press);
1901 
1925 void
1926 ei_device_text_keysym(struct ei_device *device, uint32_t keysym, bool is_press);
1927 
1945 void
1946 ei_device_text_utf8(struct ei_device *device, const char *utf8);
1947 
1967 void
1968 ei_device_text_utf8_with_length(struct ei_device *device, const char *text, size_t length);
1969 
1982 struct ei_touch *
1983 ei_device_touch_new(struct ei_device *device);
1984 
1998 void
1999 ei_touch_down(struct ei_touch *touch, double x, double y);
2000 
2006 void
2007 ei_touch_motion(struct ei_touch *touch, double x, double y);
2008 
2016 void
2017 ei_touch_up(struct ei_touch *touch);
2018 
2030 void
2031 ei_touch_cancel(struct ei_touch *touch);
2032 
2041 struct ei_touch *
2042 ei_touch_ref(struct ei_touch *touch);
2043 
2052 struct ei_touch *
2053 ei_touch_unref(struct ei_touch *touch);
2054 
2062 void
2063 ei_touch_set_user_data(struct ei_touch *touch, void *user_data);
2064 
2071 void *
2072 ei_touch_get_user_data(struct ei_touch *touch);
2073 
2079 struct ei_device *
2080 ei_touch_get_device(struct ei_touch *touch);
2081 
2091 struct ei_seat *
2092 ei_event_get_seat(struct ei_event *event);
2093 
2103 struct ei_ping *
2104 ei_event_pong_get_ping(struct ei_event *event);
2105 
2114 uint32_t
2116 
2124 uint32_t
2126 
2134 uint32_t
2136 
2144 uint32_t
2146 
2167 uint32_t
2169 
2176 double
2177 ei_event_pointer_get_dx(struct ei_event *event);
2178 
2185 double
2186 ei_event_pointer_get_dy(struct ei_event *event);
2187 
2194 double
2196 
2203 double
2205 
2212 uint32_t
2213 ei_event_button_get_button(struct ei_event *event);
2214 
2221 bool
2222 ei_event_button_get_is_press(struct ei_event *event);
2223 
2230 double
2231 ei_event_scroll_get_dx(struct ei_event *event);
2232 
2239 double
2240 ei_event_scroll_get_dy(struct ei_event *event);
2241 
2248 bool
2249 ei_event_scroll_get_stop_x(struct ei_event *event);
2250 
2257 bool
2258 ei_event_scroll_get_stop_y(struct ei_event *event);
2259 
2266 int32_t
2268 
2275 int32_t
2277 
2284 uint32_t
2285 ei_event_keyboard_get_key(struct ei_event *event);
2286 
2293 bool
2295 
2308 uint32_t
2309 ei_event_touch_get_id(struct ei_event *event);
2310 
2318 double
2319 ei_event_touch_get_x(struct ei_event *event);
2320 
2328 double
2329 ei_event_touch_get_y(struct ei_event *event);
2330 
2341 bool
2342 ei_event_touch_get_is_cancel(struct ei_event *event);
2343 
2352 uint32_t
2353 ei_event_text_get_keysym(struct ei_event *event);
2354 
2364 bool
2366 
2375 const char *
2376 ei_event_text_get_utf8(struct ei_event *event);
2377 
2382 #ifdef __cplusplus
2383 }
2384 #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.
Event for a single keysym logically pressed/released on this device.
Definition: libei.h:619
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.
void ei_device_text_utf8_with_length(struct ei_device *device, const char *text, size_t length)
Generate a UTF-8 text event on a device with the EI_DEVICE_CAP_TEXT capability.
bool ei_event_text_get_keysym_is_press(struct ei_event *event)
For an event of type EI_EVENT_TEXT_KEYSYM return true if the event is a logical key down for the keys...
const char * ei_event_text_get_utf8(struct ei_event *event)
For an event of type EI_EVENT_TEXT_UTF8 return the zero-terminated UTF8 string.
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:491
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:481
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps...
Definition: libei.h:572
ei_log_priority
Definition: libei.h:728
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:375
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:599
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...
Event for a UTF-8 compatible text sequence sent by this device.
Definition: libei.h:629
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:541
uint64_t(* ei_clock_now_func)(struct ei *ei)
Optional override function for ei_now().
Definition: libei.h:812
struct ei_seat * ei_seat_unref(struct ei_seat *seat)
The device can send relative motion events.
Definition: libei.h:279
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:591
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:515
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:250
The device can send scroll events.
Definition: libei.h:295
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:731
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:729
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:299
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:386
A libxkbcommon-compatible XKB keymap.
Definition: libei.h:317
The server has removed a device belonging to this client.
Definition: libei.h:398
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:283
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:775
The server has changed the modifier state on the device's keymap.
Definition: libei.h:461
void ei_disconnect(struct ei *ei)
Disconnect the current ei context from the EIS implementation.
The device can send touch events.
Definition: libei.h:291
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)
A 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:363
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:732
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.
void ei_device_text_utf8(struct ei_device *device, const char *utf8)
Generate a UTF-8 text event on a device with the EI_DEVICE_CAP_TEXT capability.
ei_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition: libei.h:329
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:557
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:550
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:352
ei_device_capability
The set of supported capabilities.
Definition: libei.h:275
uint32_t ei_region_get_height(struct ei_region *region)
void ei_seat_request_device_with_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Request a new device with (a subset of) the given capabilities from the EIS implementation.
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:338
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:413
The server is about to send events for a device.
Definition: libei.h:507
Event for a single currently-down touch changing position (or other properties).
Definition: libei.h:607
An ongoing scroll sequence was cancelled.
Definition: libei.h:564
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:730
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:533
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:421
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_device_text_keysym(struct ei_device *device, uint32_t keysym, bool is_press)
Generate a key event on a device with the EI_DEVICE_CAP_TEXT capability.
void ei_touch_cancel(struct ei_touch *touch)
Cancel this touch.
uint32_t ei_event_text_get_keysym(struct ei_event *event)
For an event of type EI_EVENT_TEXT_KEYSYM return the XKB-compatible keysym.
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:580
Returned in response to ei_ping().
Definition: libei.h:470
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:250
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:287
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:524
The device can send text-like data.
Definition: libei.h:305
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:313