libei  1.5.0
A library for Emulated Input
libeis.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 
26 #pragma once
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stddef.h>
33 #include <stdbool.h>
34 #include <stdint.h>
35 #include <sys/types.h>
36 
125 struct eis;
129 struct eis_client;
133 struct eis_device;
137 struct eis_seat;
141 struct eis_event;
145 struct eis_keymap;
149 struct eis_touch;
150 
159 struct eis_ping;
160 
189 struct eis_region;
190 
216 };
217 
229 };
230 
237 };
238 
261 
268 
274 
279 
293 
305 
327 
328  /* These events are only generated on a receiving EIS context */
329 
362 
367 
385 };
386 
392 const char*
394 
398 struct eis *
399 eis_new(void *user_data);
400 
409 };
410 
414 struct eis_log_context;
415 
420 unsigned int
421 eis_log_context_get_line(struct eis_log_context *ctx);
422 
427 const char *
428 eis_log_context_get_file(struct eis_log_context *ctx);
429 
434 const char *
435 eis_log_context_get_func(struct eis_log_context *ctx);
436 
449 typedef void (*eis_log_handler)(struct eis *eis,
450  enum eis_log_priority priority,
451  const char *message,
452  struct eis_log_context *ctx);
463 void
464 eis_log_set_handler(struct eis *eis, eis_log_handler log_handler);
465 
469 void
470 eis_log_set_priority(struct eis *eis, enum eis_log_priority priority);
471 
475 enum eis_log_priority
476 eis_log_get_priority(const struct eis *eis);
477 
486 typedef uint64_t (*eis_clock_now_func)(struct eis *eis);
487 
493 void
494 eis_clock_set_now_func(struct eis *, eis_clock_now_func func);
495 
496 struct eis *
497 eis_ref(struct eis *eis);
498 
499 struct eis *
500 eis_unref(struct eis *eis);
501 
502 void *
503 eis_get_user_data(struct eis *eis);
504 
505 void
506 eis_set_user_data(struct eis *eis, void *user_data);
507 
516 int
517 eis_setup_backend_fd(struct eis *ctx);
518 
524 int
525 eis_backend_fd_add_client(struct eis *ctx);
526 
536 int
537 eis_setup_backend_socket(struct eis *ctx, const char *path);
538 
539 
548 pid_t
550 
557 int
558 eis_get_fd(struct eis *eis);
559 
569 void
570 eis_dispatch(struct eis *eis);
571 
584 uint64_t
585 eis_ping_get_id(struct eis_ping *ping);
586 
595 struct eis_ping *
597 
607 struct eis_ping *
609 
617 void
618 eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data);
619 
626 void *
628 
641 void
642 eis_ping(struct eis_ping *ping);
643 
654 struct eis_event *
655 eis_get_event(struct eis *eis);
656 
673 struct eis_event *
674 eis_peek_event(struct eis *eis);
675 
684 struct eis_event *
685 eis_event_ref(struct eis_event *event);
686 
696 struct eis_event *
697 eis_event_unref(struct eis_event *event);
698 
699 enum eis_event_type
700 eis_event_get_type(struct eis_event *event);
701 
702 struct eis_client *
703 eis_event_get_client(struct eis_event *event);
704 
705 struct eis_seat *
706 eis_event_get_seat(struct eis_event *event);
707 
717 struct eis_ping *
718 eis_event_pong_get_ping(struct eis_event *event);
719 
727 bool
729 
736 struct eis_device *
737 eis_event_get_device(struct eis_event *event);
738 
748 uint64_t
749 eis_event_get_time(struct eis_event *event);
750 
760 struct eis_ping *
761 eis_client_new_ping(struct eis_client *client);
762 
763 struct eis_client *
764 eis_client_ref(struct eis_client *client);
765 
766 struct eis_client *
767 eis_client_unref(struct eis_client *client);
768 
769 void *
771 
772 void
773 eis_client_set_user_data(struct eis_client *eis_client, void *user_data);
774 
775 struct eis*
776 eis_client_get_context(struct eis_client *client);
777 
783 bool
784 eis_client_is_sender(struct eis_client *client);
785 
790 const char *
791 eis_client_get_name(struct eis_client *client);
792 
802 void
803 eis_client_connect(struct eis_client *client);
804 
813 void
814 eis_client_disconnect(struct eis_client *client);
815 
828 struct eis_seat *
829 eis_client_new_seat(struct eis_client *client, const char *name);
830 
834 struct eis_seat *
835 eis_seat_ref(struct eis_seat *seat);
836 
840 struct eis_seat *
841 eis_seat_unref(struct eis_seat *seat);
842 
846 struct eis_client *
848 
852 const char *
854 
858 void *
860 
864 void
865 eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data);
866 
870 bool
871 eis_seat_has_capability(struct eis_seat *seat,
872  enum eis_device_capability cap);
873 
886 void
888  enum eis_device_capability cap);
889 
896 void
897 eis_seat_add(struct eis_seat *seat);
898 
904 void
905 eis_seat_remove(struct eis_seat *seat);
906 
910 struct eis *
911 eis_seat_get_context(struct eis_seat *seat);
912 
916 struct eis *
917 eis_device_get_context(struct eis_device *device);
918 
922 struct eis_client *
923 eis_device_get_client(struct eis_device *device);
924 
928 struct eis_seat *
929 eis_device_get_seat(struct eis_device *device);
930 
934 struct eis_device *
935 eis_device_ref(struct eis_device *device);
936 
940 struct eis_device *
941 eis_device_unref(struct eis_device *device);
942 
946 void *
948 
952 void
953 eis_device_set_user_data(struct eis_device *eis_device, void *user_data);
954 
962 const char *
963 eis_device_get_name(struct eis_device *device);
964 
968 bool
970  enum eis_device_capability cap);
971 
978 uint32_t
979 eis_device_get_width(struct eis_device *device);
980 
987 uint32_t
988 eis_device_get_height(struct eis_device *device);
989 
1009 struct eis_device *
1010 eis_seat_new_device(struct eis_seat *seat);
1011 
1020 void
1021 eis_device_configure_type(struct eis_device *device, enum eis_device_type type);
1022 
1026 enum eis_device_type
1027 eis_device_get_type(struct eis_device *device);
1028 
1032 void
1033 eis_device_configure_name(struct eis_device *device, const char *name);
1034 
1038 void
1040 
1055 void
1056 eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height);
1057 
1070 struct eis_region *
1071 eis_device_new_region(struct eis_device *device);
1072 
1078 void
1079 eis_region_set_size(struct eis_region *region, uint32_t w, uint32_t h);
1080 
1086 void
1087 eis_region_set_offset(struct eis_region *region, uint32_t x, uint32_t y);
1088 
1101 void
1102 eis_region_set_physical_scale(struct eis_region *region, double scale);
1103 
1127 void
1128 eis_region_set_mapping_id(struct eis_region *region, const char *mapping_id);
1129 
1148 const char *
1149 eis_region_get_mapping_id(struct eis_region *region);
1150 
1159 void
1160 eis_region_add(struct eis_region *region);
1161 
1181 struct eis_region *
1182 eis_device_get_region(struct eis_device *device, size_t index);
1183 
1192 struct eis_region *
1193 eis_device_get_region_at(struct eis_device *device, double x, double y);
1194 
1198 struct eis_region *
1199 eis_region_ref(struct eis_region *region);
1200 
1204 struct eis_region *
1205 eis_region_unref(struct eis_region *region);
1206 
1210 void *
1211 eis_region_get_user_data(struct eis_region *region);
1212 
1216 void
1217 eis_region_set_user_data(struct eis_region *region, void *user_data);
1218 
1222 uint32_t
1223 eis_region_get_x(struct eis_region *region);
1224 
1228 uint32_t
1229 eis_region_get_y(struct eis_region *region);
1230 
1234 uint32_t
1235 eis_region_get_width(struct eis_region *region);
1236 
1240 uint32_t
1241 eis_region_get_height(struct eis_region *region);
1242 
1246 double
1248 
1254 bool
1255 eis_region_contains(struct eis_region *region, double x, double y);
1256 
1266 void
1267 eis_device_add(struct eis_device *device);
1268 
1276 void
1277 eis_device_remove(struct eis_device *device);
1278 
1299 void
1300 eis_device_pause(struct eis_device *device);
1301 
1310 void
1311 eis_device_resume(struct eis_device *device);
1312 
1332 struct eis_keymap *
1333 eis_device_new_keymap(struct eis_device *device,
1334  enum eis_keymap_type type, int fd, size_t size);
1335 
1351 void
1352 eis_keymap_add(struct eis_keymap *keymap);
1353 
1358 size_t
1359 eis_keymap_get_size(struct eis_keymap *keymap);
1360 
1367 enum eis_keymap_type
1368 eis_keymap_get_type(struct eis_keymap *keymap);
1369 
1377 int
1378 eis_keymap_get_fd(struct eis_keymap *keymap);
1379 
1383 struct eis_keymap *
1384 eis_keymap_ref(struct eis_keymap *keymap);
1385 
1389 struct eis_keymap *
1390 eis_keymap_unref(struct eis_keymap *keymap);
1391 
1395 void *
1397 
1401 void
1402 eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data);
1403 
1409 struct eis_device *
1410 eis_keymap_get_device(struct eis_keymap *keymap);
1411 
1419 struct eis_keymap *
1421 
1443 void
1445  uint32_t depressed,
1446  uint32_t latched,
1447  uint32_t locked,
1448  uint32_t group);
1449 
1455 void
1456 eis_device_start_emulating(struct eis_device *device, uint32_t sequence);
1457 
1463 void
1464 eis_device_stop_emulating(struct eis_device *device);
1465 
1471 void
1472 eis_device_frame(struct eis_device *device, uint64_t time);
1473 
1479 void
1480 eis_device_pointer_motion(struct eis_device *device, double x, double y);
1481 
1487 void
1489  double x, double y);
1490 
1496 void
1497 eis_device_button_button(struct eis_device *device,
1498  uint32_t button, bool is_press);
1499 
1505 void
1506 eis_device_scroll_delta(struct eis_device *device, double x, double y);
1507 
1513 void
1514 eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
1515 
1521 void
1522 eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
1523 
1529 void
1530 eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
1531 
1537 void
1538 eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press);
1539 
1545 struct eis_touch *
1546 eis_device_touch_new(struct eis_device *device);
1547 
1553 void
1554 eis_touch_down(struct eis_touch *touch, double x, double y);
1555 
1561 void
1562 eis_touch_motion(struct eis_touch *touch, double x, double y);
1563 
1569 void
1570 eis_touch_up(struct eis_touch *touch);
1571 
1577 void
1578 eis_touch_cancel(struct eis_touch *touch);
1579 
1585 struct eis_touch *
1586 eis_touch_ref(struct eis_touch *touch);
1587 
1593 struct eis_touch *
1594 eis_touch_unref(struct eis_touch *touch);
1595 
1601 void
1602 eis_touch_set_user_data(struct eis_touch *touch, void *user_data);
1603 
1609 void *
1610 eis_touch_get_user_data(struct eis_touch *touch);
1611 
1617 struct eis_device *
1618 eis_touch_get_device(struct eis_touch *touch);
1619 
1628 uint32_t
1630 
1637 double
1638 eis_event_pointer_get_dx(struct eis_event *event);
1639 
1646 double
1647 eis_event_pointer_get_dy(struct eis_event *event);
1648 
1655 double
1657 
1664 double
1666 
1673 uint32_t
1674 eis_event_button_get_button(struct eis_event *event);
1675 
1682 bool
1684 
1691 double
1692 eis_event_scroll_get_dx(struct eis_event *event);
1693 
1700 double
1701 eis_event_scroll_get_dy(struct eis_event *event);
1702 
1712 bool
1713 eis_event_scroll_get_stop_x(struct eis_event *event);
1714 
1724 bool
1725 eis_event_scroll_get_stop_y(struct eis_event *event);
1726 
1733 int32_t
1735 
1742 int32_t
1744 
1751 uint32_t
1752 eis_event_keyboard_get_key(struct eis_event *event);
1753 
1760 bool
1762 
1775 uint32_t
1776 eis_event_touch_get_id(struct eis_event *event);
1777 
1785 double
1786 eis_event_touch_get_x(struct eis_event *event);
1787 
1795 double
1796 eis_event_touch_get_y(struct eis_event *event);
1797 
1808 bool
1810 
1818 uint64_t
1819 eis_now(struct eis *eis);
1820 
1825 #ifdef __cplusplus
1826 }
1827 #endif
void eis_touch_up(struct eis_touch *touch)
see ei_touch_up
An ongoing scroll sequence was cancelled.
Definition: libeis.h:356
A relative motion event with delta coordinates in logical pixels or mm, depending on the device type...
Definition: libeis.h:334
The client is about to send events for a device.
Definition: libeis.h:322
void * eis_region_get_user_data(struct eis_region *region)
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...
void * eis_ping_get_user_data(struct eis_ping *eis_ping)
Return the custom data pointer for this struct.
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...
struct eis_keymap * eis_keymap_ref(struct eis_keymap *keymap)
int32_t eis_event_scroll_get_discrete_dy(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_DISCRETE return the y scroll distance in fractions or multiples...
A callback struct returned by eis_new_ping() to handle roundtrips to the client.
Definition: libeis.h:149
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_scroll_get_dx(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_DELTA return the x scroll distance in logical pixels or mm...
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.
void eis_device_configure_type(struct eis_device *device, enum eis_device_type type)
Set the device type for this device.
void eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press)
see ei_device_keyboard_key
void eis_touch_down(struct eis_touch *touch, double x, double y)
see ei_touch_down
struct eis_touch * eis_touch_unref(struct eis_touch *touch)
see ei_touch_unref
void eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y)
see ei_device_scroll_cancel
struct eis * eis_seat_get_context(struct eis_seat *seat)
enum eis_device_type eis_device_get_type(struct eis_device *device)
void eis_client_connect(struct eis_client *client)
Allow connection from the client.
eis_keymap_type
Definition: libeis.h:235
The client wants to bind or unbind a capability on this seat.
Definition: libeis.h:267
void eis_seat_configure_capability(struct eis_seat *seat, enum eis_device_capability cap)
Allow a capability on the seat.
void eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y)
see ei_device_scroll_stop
bool eis_event_scroll_get_stop_x(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_STOP return whether the x axis has stopped scrolling.
struct eis_client * eis_client_ref(struct eis_client *client)
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 ...
void eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data)
struct eis_seat * eis_seat_ref(struct eis_seat *seat)
bool eis_client_is_sender(struct eis_client *client)
Returns true if the client is a sender, false otherwise.
struct eis_ping * eis_event_pong_get_ping(struct eis_event *event)
Returns the associated eis_ping struct with this event.
struct eis_seat * eis_client_new_seat(struct eis_client *client, const char *name)
Create a new logical seat with a given name.
int eis_backend_fd_add_client(struct eis *ctx)
Add a new client to a context set up with eis_setup_backend_fd().
void eis_log_set_handler(struct eis *eis, eis_log_handler log_handler)
Change the log handler for this context.
struct eis * eis_new(void *user_data)
Create a new libeis context with a refcount of 1.
Definition: libeis.h:406
bool eis_seat_has_capability(struct eis_seat *seat, enum eis_device_capability cap)
void eis_device_frame(struct eis_device *device, uint64_t time)
see ei_device_frame
struct eis_region * eis_device_get_region(struct eis_device *device, size_t index)
Obtain a region from the device.
struct eis_device * eis_device_ref(struct eis_device *device)
void eis_ping(struct eis_ping *ping)
Issue a roundtrip request to the client, resulting in an EIS_EVENT_PONG event when this roundtrip has...
void(* eis_log_handler)(struct eis *eis, enum eis_log_priority priority, const char *message, struct eis_log_context *ctx)
The log handler for library logging.
Definition: libeis.h:449
void eis_region_set_mapping_id(struct eis_region *region, const char *mapping_id)
Attach a unique identifier representing an external resource to this region.
struct eis_region * eis_region_ref(struct eis_region *region)
struct eis_touch * eis_device_touch_new(struct eis_device *device)
see ei_device_touch_new
struct eis_device * eis_event_get_device(struct eis_event *event)
Return the device from this event.
bool eis_event_button_get_is_press(struct eis_event *event)
For an event of type EIS_EVENT_BUTTON_BUTTON return true if the event is a button press...
struct eis_seat * eis_device_get_seat(struct eis_device *device)
Definition: libeis.h:225
void eis_region_set_user_data(struct eis_region *region, void *user_data)
Definition: libeis.h:227
void * eis_keymap_get_user_data(struct eis_keymap *eis_keymap)
void eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height)
Configure the size in mm of a device of type EIS_DEVICE_TYPE_PHYSICAL.
struct eis * eis_unref(struct eis *eis)
const char * eis_seat_get_name(struct eis_seat *eis_seat)
void eis_device_button_button(struct eis_device *device, uint32_t button, bool is_press)
see ei_device_button_button
Definition: libeis.h:408
uint32_t eis_event_emulating_get_sequence(struct eis_event *event)
For an event of type EIS_EVENT_DEVICE_START_EMULATING, return the sequence number set by the ei clien...
void eis_device_configure_capability(struct eis_device *device, enum eis_device_capability cap)
Event for a single touch set down on the device's logical surface.
Definition: libeis.h:374
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 que...
Event for a single currently-down touch changing position (or other properties).
Definition: libeis.h:384
void eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y)
see ei_device_scroll_discrete
enum eis_keymap_type eis_keymap_get_type(struct eis_keymap *keymap)
Returns the type for this keymap.
void eis_device_configure_name(struct eis_device *device, const char *name)
struct eis_device * eis_device_unref(struct eis_device *device)
Definition: libeis.h:405
void eis_clock_set_now_func(struct eis *, eis_clock_now_func func)
Override the function that returns the current time eis_now().
struct eis * eis_device_get_context(struct eis_device *device)
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps...
Definition: libeis.h:361
struct eis_event * eis_event_unref(struct eis_event *event)
Decrease the refcount of this struct by one.
enum eis_log_priority eis_log_get_priority(const struct eis *eis)
void eis_device_remove(struct eis_device *device)
Remove the device.
uint64_t eis_event_get_time(struct eis_event *event)
Return the time for the event of type EIS_EVENT_FRAME in microseconds.
Definition: libeis.h:141
struct eis_ping * eis_client_new_ping(struct eis_client *client)
Create a new eis_ping object to trigger a round trip to the client.
void eis_region_set_physical_scale(struct eis_region *region, double scale)
Set the physical scale for this region.
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...
void eis_device_start_emulating(struct eis_device *device, uint32_t sequence)
see ei_device_start_emulating
void eis_seat_add(struct eis_seat *seat)
Add this seat to its client and notify the client of the seat's availability.
A vertical and/or horizontal scroll event with logical-pixels or mm precision, depending on the devic...
Definition: libeis.h:348
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...
struct eis_touch * eis_touch_ref(struct eis_touch *touch)
see ei_touch_ref
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...
pid_t eis_backend_socket_get_client_pid(struct eis_client *client)
Return the pid of the client.
eis_device_capability
Definition: libeis.h:222
An ongoing scroll sequence stopped.
Definition: libeis.h:352
int eis_setup_backend_fd(struct eis *ctx)
Initialize the context that can take pre-configured socket file descriptors, see eis_backend_fd_add_c...
void eis_device_set_user_data(struct eis_device *eis_device, void *user_data)
Definition: libeis.h:214
Returned in response to eis_ping().
Definition: libeis.h:278
Definition: libeis.h:137
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-ev...
double eis_event_scroll_get_dy(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_DELTA return the y scroll distance in logical pixels or mm...
struct eis_region * eis_device_get_region_at(struct eis_device *device, double x, double y)
Return the region that contains the given point x/y (in desktop-wide coordinates) or NULL if the coor...
A button press or release event.
Definition: libeis.h:343
Definition: libeis.h:224
enum eis_event_type eis_event_get_type(struct eis_event *event)
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 ...
Definition: libeis.h:129
Definition: libeis.h:236
struct eis * eis_client_get_context(struct eis_client *client)
struct eis_device * eis_keymap_get_device(struct eis_keymap *keymap)
Return the device this keymap belongs to.
bool eis_device_has_capability(struct eis_device *device, enum eis_device_capability cap)
struct eis_device * eis_touch_get_device(struct eis_touch *touch)
see ei_touch_get_device
void eis_device_pointer_motion_absolute(struct eis_device *device, double x, double y)
see ei_device_pointer_motion_absolute
struct eis * eis_ref(struct eis *eis)
struct eis_device * eis_seat_new_device(struct eis_seat *seat)
Create a new device on the seat.
Definition: libeis.h:407
int eis_keymap_get_fd(struct eis_keymap *keymap)
Return a memmap-able file descriptor pointing to the keymap used by the device.
struct eis_ping * eis_ping_ref(struct eis_ping *eis_ping)
Increase the refcount of this struct by one.
Definition: libeis.h:223
void eis_touch_cancel(struct eis_touch *touch)
see ei_touch_cancel
void * eis_get_user_data(struct eis *eis)
unsigned int eis_log_context_get_line(struct eis_log_context *ctx)
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_device_resume(struct eis_device *device)
Notify the client that the capabilities are resumed and that events from the device will be processed...
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_device_pointer_motion(struct eis_device *device, double x, double y)
see ei_device_pointer_motion
bool eis_region_contains(struct eis_region *region, double x, double y)
const char * eis_event_type_to_string(enum eis_event_type)
This is a debugging helper to return a string of the name of the event type, or NULL if the event typ...
bool eis_event_scroll_get_stop_y(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_STOP return whether the y axis has stopped scrolling.
void eis_device_stop_emulating(struct eis_device *device)
see ei_device_stop_emulating
struct eis_client * eis_device_get_client(struct eis_device *device)
uint32_t eis_event_button_get_button(struct eis_event *event)
For an event of type EIS_EVENT_BUTTON_BUTTON return the button code as defined in linux/input-event-c...
eis_device_type
The device type determines what the device represents.
Definition: libeis.h:213
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_region * eis_region_unref(struct eis_region *region)
void eis_set_user_data(struct eis *eis, void *user_data)
void eis_device_scroll_delta(struct eis_device *device, double x, double y)
see ei_device_scroll_delta
struct eis_client * eis_client_unref(struct eis_client *client)
Definition: libeis.h:133
Regions are only available on devices of type EIS_DEVICE_TYPE_VIRTUAL.
Definition: libeis.h:159
Definition: libeis.h:145
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.
void eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data)
The client no longer listens to events from this device.
Definition: libeis.h:273
void * eis_device_get_user_data(struct eis_device *eis_device)
void * eis_client_get_user_data(struct eis_client *eis_client)
struct eis_keymap * eis_device_keyboard_get_keymap(struct eis_device *device)
Return the keymap assigned to this device.
void eis_touch_set_user_data(struct eis_touch *touch, void *user_data)
see ei_touch_set_user_data
void * eis_seat_get_user_data(struct eis_seat *eis_seat)
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.
bool eis_event_touch_get_is_cancel(struct eis_event *event)
For an event of type EIS_EVENT_TOUCH_UP return true if the touch was cancelled instead of logically r...
uint64_t(* eis_clock_now_func)(struct eis *eis)
Optional override function for eis_now().
Definition: libeis.h:486
void * eis_touch_get_user_data(struct eis_touch *touch)
see ei_touch_get_user_data
A client has connected.
Definition: libeis.h:255
uint64_t eis_now(struct eis *eis)
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.
void eis_dispatch(struct eis *eis)
Main event dispatching function.
void eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data)
Set a custom data pointer for this struct.
size_t eis_keymap_get_size(struct eis_keymap *keymap)
Definition: libeis.h:226
This event represents a synchronization request (ping) from the client implementation.
Definition: libeis.h:292
Event for a single touch released from the device's logical surface.
Definition: libeis.h:379
int eis_get_fd(struct eis *eis)
libeis keeps a single file descriptor for all events.
Definition: libeis.h:125
Stop emulating events on this device, see EIS_EVENT_DEVICE_START_EMULATING.
Definition: libeis.h:326
struct eis_seat * eis_event_get_seat(struct eis_event *event)
bool eis_event_seat_has_capability(struct eis_event *event, enum eis_device_capability cap)
For an event of type EIS_EVENT_SEAT_BIND, return the capabilities requested by the client...
uint32_t eis_region_get_height(struct eis_region *region)
eis_log_priority
Definition: libeis.h:404
int eis_setup_backend_socket(struct eis *ctx, const char *path)
Initialize the context with a UNIX socket name.
struct eis_ping * eis_ping_unref(struct eis_ping *eis_ping)
Decrease the refcount of this struct by one.
struct eis_region * eis_device_new_region(struct eis_device *device)
Create a new region on the device of type EIS_DEVICE_TYPE_VIRTUAL with an initial refcount of 1...
void eis_seat_remove(struct eis_seat *seat)
Remove this seat and all its remaining devices.
struct eis_keymap * eis_keymap_unref(struct eis_keymap *keymap)
const char * eis_log_context_get_func(struct eis_log_context *ctx)
const char * eis_device_get_name(struct eis_device *device)
Return the name of the device.
uint32_t eis_region_get_width(struct eis_region *region)
void eis_touch_motion(struct eis_touch *touch, double x, double y)
see ei_touch_motion
struct eis_client * eis_seat_get_client(struct eis_seat *eis_seat)
"Hardware" frame event.
Definition: libeis.h:304
void eis_client_set_user_data(struct eis_client *eis_client, void *user_data)
double eis_region_get_physical_scale(struct eis_region *region)
int32_t eis_event_scroll_get_discrete_dx(struct eis_event *event)
For an event of type EIS_EVENT_SCROLL_DISCRETE return the x scroll distance in fractions or multiples...
A key press or release event.
Definition: libeis.h:366
struct eis_event * eis_event_ref(struct eis_event *event)
Increase the refcount of this struct by one.
void eis_log_set_priority(struct eis *eis, enum eis_log_priority priority)
The client has disconnected, any pending requests for this client should be discarded.
Definition: libeis.h:260
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...
uint32_t eis_region_get_y(struct eis_region *region)
void eis_region_add(struct eis_region *region)
Add the given region to its device.
void eis_device_add(struct eis_device *device)
Add this device to its seat and notify the client of the device's availability.
struct eis_seat * eis_seat_unref(struct eis_seat *seat)
uint64_t eis_ping_get_id(struct eis_ping *ping)
Return a unique, increasing id for this struct.
const char * eis_client_get_name(struct eis_client *client)
Return the name set by this client.
uint32_t eis_region_get_x(struct eis_region *region)
const char * eis_log_context_get_file(struct eis_log_context *ctx)
struct eis_client * eis_event_get_client(struct eis_event *event)
Definition: libeis.h:215
const char * eis_region_get_mapping_id(struct eis_region *region)
Get the unique ID for this region previously set by this caller, if any, or NULL if the client does n...
void eis_keymap_add(struct eis_keymap *keymap)
Set the keymap on the device.
eis_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition: libeis.h:248
void eis_client_disconnect(struct eis_client *client)
Disconnect this client.
An absolute motion event with absolute position within the device's regions or size, depending on the device type.
Definition: libeis.h:339
Definition: libeis.h:228