libei 1.4.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
115
120
124 struct eis;
128 struct eis_client;
132 struct eis_device;
136 struct eis_seat;
140 struct eis_event;
144 struct eis_keymap;
148 struct eis_touch;
149
158 struct eis_ping;
159
188 struct eis_region;
189
212 enum eis_device_type {
213 EIS_DEVICE_TYPE_VIRTUAL = 1,
214 EIS_DEVICE_TYPE_PHYSICAL
215};
216
221 enum eis_device_capability {
222 EIS_DEVICE_CAP_POINTER = (1 << 0),
223 EIS_DEVICE_CAP_POINTER_ABSOLUTE = (1 << 1),
224 EIS_DEVICE_CAP_KEYBOARD = (1 << 2),
225 EIS_DEVICE_CAP_TOUCH = (1 << 3),
226 EIS_DEVICE_CAP_SCROLL = (1 << 4),
227 EIS_DEVICE_CAP_BUTTON = (1 << 5),
228};
229
234 enum eis_keymap_type {
235 EIS_KEYMAP_TYPE_XKB = 1,
236};
237
247 enum eis_event_type {
254 EIS_EVENT_CLIENT_CONNECT = 1,
259 EIS_EVENT_CLIENT_DISCONNECT,
260
266 EIS_EVENT_SEAT_BIND,
267
272 EIS_EVENT_DEVICE_CLOSED,
273
277 EIS_EVENT_PONG = 90,
278
291 EIS_EVENT_SYNC,
292
303 EIS_EVENT_FRAME = 100,
304
321 EIS_EVENT_DEVICE_START_EMULATING = 200,
325 EIS_EVENT_DEVICE_STOP_EMULATING,
326
327 /* These events are only generated on a receiving EIS context */
328
333 EIS_EVENT_POINTER_MOTION = 300,
338 EIS_EVENT_POINTER_MOTION_ABSOLUTE = 400,
342 EIS_EVENT_BUTTON_BUTTON = 500,
347 EIS_EVENT_SCROLL_DELTA = 600,
351 EIS_EVENT_SCROLL_STOP,
355 EIS_EVENT_SCROLL_CANCEL,
360 EIS_EVENT_SCROLL_DISCRETE,
361
365 EIS_EVENT_KEYBOARD_KEY = 700,
366
373 EIS_EVENT_TOUCH_DOWN = 800,
378 EIS_EVENT_TOUCH_UP,
383 EIS_EVENT_TOUCH_MOTION,
384};
385
391 const char*
392 eis_event_type_to_string(enum eis_event_type);
393
397 struct eis *
398 eis_new(void *user_data);
399
403 enum eis_log_priority {
404 EIS_LOG_PRIORITY_DEBUG = 10,
405 EIS_LOG_PRIORITY_INFO = 20,
406 EIS_LOG_PRIORITY_WARNING = 30,
407 EIS_LOG_PRIORITY_ERROR = 40,
408};
409
413 struct eis_log_context;
414
419 unsigned int
420 eis_log_context_get_line(struct eis_log_context *ctx);
421
426 const char *
427 eis_log_context_get_file(struct eis_log_context *ctx);
428
433 const char *
434 eis_log_context_get_func(struct eis_log_context *ctx);
435
448 typedef void (*eis_log_handler)(struct eis *eis,
449 enum eis_log_priority priority,
450 const char *message,
451 struct eis_log_context *ctx);
462 void
463 eis_log_set_handler(struct eis *eis, eis_log_handler log_handler);
464
468 void
469 eis_log_set_priority(struct eis *eis, enum eis_log_priority priority);
470
474 enum eis_log_priority
475 eis_log_get_priority(const struct eis *eis);
476
485 typedef uint64_t (*eis_clock_now_func)(struct eis *eis);
486
492 void
493 eis_clock_set_now_func(struct eis *, eis_clock_now_func func);
494
495 struct eis *
496 eis_ref(struct eis *eis);
497
498 struct eis *
499 eis_unref(struct eis *eis);
500
501 void *
502 eis_get_user_data(struct eis *eis);
503
504 void
505 eis_set_user_data(struct eis *eis, void *user_data);
506
515 int
516 eis_setup_backend_fd(struct eis *ctx);
517
523 int
524 eis_backend_fd_add_client(struct eis *ctx);
525
535 int
536 eis_setup_backend_socket(struct eis *ctx, const char *path);
537
544 int
545 eis_get_fd(struct eis *eis);
546
556 void
557 eis_dispatch(struct eis *eis);
558
571uint64_t
572 eis_ping_get_id(struct eis_ping *ping);
573
582 struct eis_ping *
583 eis_ping_ref(struct eis_ping *eis_ping);
584
594 struct eis_ping *
595 eis_ping_unref(struct eis_ping *eis_ping);
596
604 void
605 eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data);
606
613 void *
614 eis_ping_get_user_data(struct eis_ping *eis_ping);
615
628 void
629 eis_ping(struct eis_ping *ping);
630
641 struct eis_event *
642 eis_get_event(struct eis *eis);
643
660 struct eis_event *
661 eis_peek_event(struct eis *eis);
662
672 struct eis_event *
673 eis_event_unref(struct eis_event *event);
674
675 enum eis_event_type
676 eis_event_get_type(struct eis_event *event);
677
678 struct eis_client *
679 eis_event_get_client(struct eis_event *event);
680
681 struct eis_seat *
682 eis_event_get_seat(struct eis_event *event);
683
693 struct eis_ping *
694 eis_event_pong_get_ping(struct eis_event *event);
695
703 bool
704 eis_event_seat_has_capability(struct eis_event *event, enum eis_device_capability cap);
705
712 struct eis_device *
713 eis_event_get_device(struct eis_event *event);
714
724uint64_t
725 eis_event_get_time(struct eis_event *event);
726
736 struct eis_ping *
737 eis_client_new_ping(struct eis_client *client);
738
739 struct eis_client *
740 eis_client_ref(struct eis_client *client);
741
742 struct eis_client *
743 eis_client_unref(struct eis_client *client);
744
745 void *
746 eis_client_get_user_data(struct eis_client *eis_client);
747
748 void
749 eis_client_set_user_data(struct eis_client *eis_client, void *user_data);
750
751 struct eis*
752 eis_client_get_context(struct eis_client *client);
753
759 bool
760 eis_client_is_sender(struct eis_client *client);
761
766 const char *
767 eis_client_get_name(struct eis_client *client);
768
778 void
779 eis_client_connect(struct eis_client *client);
780
789 void
790 eis_client_disconnect(struct eis_client *client);
791
804 struct eis_seat *
805 eis_client_new_seat(struct eis_client *client, const char *name);
806
810 struct eis_seat *
811 eis_seat_ref(struct eis_seat *seat);
812
816 struct eis_seat *
817 eis_seat_unref(struct eis_seat *seat);
818
822 struct eis_client *
823 eis_seat_get_client(struct eis_seat *eis_seat);
824
828 const char *
829 eis_seat_get_name(struct eis_seat *eis_seat);
830
834 void *
835 eis_seat_get_user_data(struct eis_seat *eis_seat);
836
840 void
841 eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data);
842
846 bool
847 eis_seat_has_capability(struct eis_seat *seat,
848 enum eis_device_capability cap);
849
862 void
863 eis_seat_configure_capability(struct eis_seat *seat,
864 enum eis_device_capability cap);
865
872 void
873 eis_seat_add(struct eis_seat *seat);
874
880 void
881 eis_seat_remove(struct eis_seat *seat);
882
886 struct eis *
887 eis_seat_get_context(struct eis_seat *seat);
888
892 struct eis *
893 eis_device_get_context(struct eis_device *device);
894
898 struct eis_client *
899 eis_device_get_client(struct eis_device *device);
900
904 struct eis_seat *
905 eis_device_get_seat(struct eis_device *device);
906
910 struct eis_device *
911 eis_device_ref(struct eis_device *device);
912
916 struct eis_device *
917 eis_device_unref(struct eis_device *device);
918
922 void *
923 eis_device_get_user_data(struct eis_device *eis_device);
924
928 void
929 eis_device_set_user_data(struct eis_device *eis_device, void *user_data);
930
938 const char *
939 eis_device_get_name(struct eis_device *device);
940
944 bool
945 eis_device_has_capability(struct eis_device *device,
946 enum eis_device_capability cap);
947
954uint32_t
955 eis_device_get_width(struct eis_device *device);
956
963uint32_t
964 eis_device_get_height(struct eis_device *device);
965
985 struct eis_device *
986 eis_seat_new_device(struct eis_seat *seat);
987
996 void
997 eis_device_configure_type(struct eis_device *device, enum eis_device_type type);
998
1002 enum eis_device_type
1003 eis_device_get_type(struct eis_device *device);
1004
1008 void
1009 eis_device_configure_name(struct eis_device *device, const char *name);
1010
1014 void
1015 eis_device_configure_capability(struct eis_device *device, enum eis_device_capability cap);
1016
1031 void
1032 eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height);
1033
1046 struct eis_region *
1047 eis_device_new_region(struct eis_device *device);
1048
1054 void
1055 eis_region_set_size(struct eis_region *region, uint32_t w, uint32_t h);
1056
1062 void
1063 eis_region_set_offset(struct eis_region *region, uint32_t x, uint32_t y);
1064
1077 void
1078 eis_region_set_physical_scale(struct eis_region *region, double scale);
1079
1103 void
1104 eis_region_set_mapping_id(struct eis_region *region, const char *mapping_id);
1105
1124 const char *
1125 eis_region_get_mapping_id(struct eis_region *region);
1126
1135 void
1136 eis_region_add(struct eis_region *region);
1137
1157 struct eis_region *
1158 eis_device_get_region(struct eis_device *device, size_t index);
1159
1168 struct eis_region *
1169 eis_device_get_region_at(struct eis_device *device, double x, double y);
1170
1174 struct eis_region *
1175 eis_region_ref(struct eis_region *region);
1176
1180 struct eis_region *
1181 eis_region_unref(struct eis_region *region);
1182
1186 void *
1187 eis_region_get_user_data(struct eis_region *region);
1188
1192 void
1193 eis_region_set_user_data(struct eis_region *region, void *user_data);
1194
1198uint32_t
1199 eis_region_get_x(struct eis_region *region);
1200
1204uint32_t
1205 eis_region_get_y(struct eis_region *region);
1206
1210uint32_t
1211 eis_region_get_width(struct eis_region *region);
1212
1216uint32_t
1217 eis_region_get_height(struct eis_region *region);
1218
1222 double
1223 eis_region_get_physical_scale(struct eis_region *region);
1224
1230 bool
1231 eis_region_contains(struct eis_region *region, double x, double y);
1232
1242 void
1243 eis_device_add(struct eis_device *device);
1244
1252 void
1253 eis_device_remove(struct eis_device *device);
1254
1275 void
1276 eis_device_pause(struct eis_device *device);
1277
1286 void
1287 eis_device_resume(struct eis_device *device);
1288
1308 struct eis_keymap *
1309 eis_device_new_keymap(struct eis_device *device,
1310 enum eis_keymap_type type, int fd, size_t size);
1311
1327 void
1328 eis_keymap_add(struct eis_keymap *keymap);
1329
1334 size_t
1335 eis_keymap_get_size(struct eis_keymap *keymap);
1336
1343 enum eis_keymap_type
1344 eis_keymap_get_type(struct eis_keymap *keymap);
1345
1353 int
1354 eis_keymap_get_fd(struct eis_keymap *keymap);
1355
1359 struct eis_keymap *
1360 eis_keymap_ref(struct eis_keymap *keymap);
1361
1365 struct eis_keymap *
1366 eis_keymap_unref(struct eis_keymap *keymap);
1367
1371 void *
1372 eis_keymap_get_user_data(struct eis_keymap *eis_keymap);
1373
1377 void
1378 eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data);
1379
1385 struct eis_device *
1386 eis_keymap_get_device(struct eis_keymap *keymap);
1387
1395 struct eis_keymap *
1396 eis_device_keyboard_get_keymap(struct eis_device *device);
1397
1419 void
1420 eis_device_keyboard_send_xkb_modifiers(struct eis_device *device,
1421 uint32_t depressed,
1422 uint32_t latched,
1423 uint32_t locked,
1424 uint32_t group);
1425
1431 void
1432 eis_device_start_emulating(struct eis_device *device, uint32_t sequence);
1433
1439 void
1440 eis_device_stop_emulating(struct eis_device *device);
1441
1447 void
1448 eis_device_frame(struct eis_device *device, uint64_t time);
1449
1455 void
1456 eis_device_pointer_motion(struct eis_device *device, double x, double y);
1457
1463 void
1464 eis_device_pointer_motion_absolute(struct eis_device *device,
1465 double x, double y);
1466
1472 void
1473 eis_device_button_button(struct eis_device *device,
1474 uint32_t button, bool is_press);
1475
1481 void
1482 eis_device_scroll_delta(struct eis_device *device, double x, double y);
1483
1489 void
1490 eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
1491
1497 void
1498 eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
1499
1505 void
1506 eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
1507
1513 void
1514 eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press);
1515
1521 struct eis_touch *
1522 eis_device_touch_new(struct eis_device *device);
1523
1529 void
1530 eis_touch_down(struct eis_touch *touch, double x, double y);
1531
1537 void
1538 eis_touch_motion(struct eis_touch *touch, double x, double y);
1539
1545 void
1546 eis_touch_up(struct eis_touch *touch);
1547
1553 void
1554 eis_touch_cancel(struct eis_touch *touch);
1555
1561 struct eis_touch *
1562 eis_touch_ref(struct eis_touch *touch);
1563
1569 struct eis_touch *
1570 eis_touch_unref(struct eis_touch *touch);
1571
1577 void
1578 eis_touch_set_user_data(struct eis_touch *touch, void *user_data);
1579
1585 void *
1586 eis_touch_get_user_data(struct eis_touch *touch);
1587
1593 struct eis_device *
1594 eis_touch_get_device(struct eis_touch *touch);
1595
1604uint32_t
1605 eis_event_emulating_get_sequence(struct eis_event *event);
1606
1613 double
1614 eis_event_pointer_get_dx(struct eis_event *event);
1615
1622 double
1623 eis_event_pointer_get_dy(struct eis_event *event);
1624
1631 double
1632 eis_event_pointer_get_absolute_x(struct eis_event *event);
1633
1640 double
1641 eis_event_pointer_get_absolute_y(struct eis_event *event);
1642
1649uint32_t
1650 eis_event_button_get_button(struct eis_event *event);
1651
1658 bool
1659 eis_event_button_get_is_press(struct eis_event *event);
1660
1667 double
1668 eis_event_scroll_get_dx(struct eis_event *event);
1669
1676 double
1677 eis_event_scroll_get_dy(struct eis_event *event);
1678
1688 bool
1689 eis_event_scroll_get_stop_x(struct eis_event *event);
1690
1700 bool
1701 eis_event_scroll_get_stop_y(struct eis_event *event);
1702
1709int32_t
1710 eis_event_scroll_get_discrete_dx(struct eis_event *event);
1711
1718int32_t
1719 eis_event_scroll_get_discrete_dy(struct eis_event *event);
1720
1727uint32_t
1728 eis_event_keyboard_get_key(struct eis_event *event);
1729
1736 bool
1737 eis_event_keyboard_get_key_is_press(struct eis_event *event);
1738
1751uint32_t
1752 eis_event_touch_get_id(struct eis_event *event);
1753
1761 double
1762 eis_event_touch_get_x(struct eis_event *event);
1763
1771 double
1772 eis_event_touch_get_y(struct eis_event *event);
1773
1784 bool
1785 eis_event_touch_get_is_cancel(struct eis_event *event);
1786
1794uint64_t
1795 eis_now(struct eis *eis);
1796
1800
1801#ifdef __cplusplus
1802}
1803#endif
eis_device_configure_type
void eis_device_configure_type(struct eis_device *device, enum eis_device_type type)
Set the device type for this device.
eis_device_has_capability
bool eis_device_has_capability(struct eis_device *device, enum eis_device_capability cap)
eis_device_remove
void eis_device_remove(struct eis_device *device)
Remove the device.
eis_device_get_height
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.
eis_device_new_keymap
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.
eis_device_set_user_data
void eis_device_set_user_data(struct eis_device *eis_device, void *user_data)
eis_device_unref
struct eis_device * eis_device_unref(struct eis_device *device)
eis_device_configure_size
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.
eis_device_get_user_data
void * eis_device_get_user_data(struct eis_device *eis_device)
eis_device_resume
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...
eis_device_get_name
const char * eis_device_get_name(struct eis_device *device)
Return the name of the device.
eis_device_keyboard_send_xkb_modifiers
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.
eis_device_ref
struct eis_device * eis_device_ref(struct eis_device *device)
eis_device_pause
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.
eis_device_get_seat
struct eis_seat * eis_device_get_seat(struct eis_device *device)
eis_device_configure_name
void eis_device_configure_name(struct eis_device *device, const char *name)
eis_device_get_type
enum eis_device_type eis_device_get_type(struct eis_device *device)
eis_device_new_region
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.
eis_device_configure_capability
void eis_device_configure_capability(struct eis_device *device, enum eis_device_capability cap)
eis_device_keyboard_get_keymap
struct eis_keymap * eis_device_keyboard_get_keymap(struct eis_device *device)
Return the keymap assigned to this device.
eis_device_get_region_at
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...
eis_device_get_width
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.
eis_device_get_context
struct eis * eis_device_get_context(struct eis_device *device)
eis_device_get_region
struct eis_region * eis_device_get_region(struct eis_device *device, size_t index)
Obtain a region from the device.
eis_device_add
void eis_device_add(struct eis_device *device)
Add this device to its seat and notify the client of the device's availability.
eis_device_get_client
struct eis_client * eis_device_get_client(struct eis_device *device)
eis_keymap_unref
struct eis_keymap * eis_keymap_unref(struct eis_keymap *keymap)
eis_keymap_get_size
size_t eis_keymap_get_size(struct eis_keymap *keymap)
eis_keymap_get_user_data
void * eis_keymap_get_user_data(struct eis_keymap *eis_keymap)
eis_keymap_get_type
enum eis_keymap_type eis_keymap_get_type(struct eis_keymap *keymap)
Returns the type for this keymap.
eis_keymap_ref
struct eis_keymap * eis_keymap_ref(struct eis_keymap *keymap)
eis_keymap_get_fd
int eis_keymap_get_fd(struct eis_keymap *keymap)
Return a memmap-able file descriptor pointing to the keymap used by the device.
eis_keymap_get_device
struct eis_device * eis_keymap_get_device(struct eis_keymap *keymap)
Return the device this keymap belongs to.
eis_keymap_set_user_data
void eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data)
eis_keymap_add
void eis_keymap_add(struct eis_keymap *keymap)
Set the keymap on the device.
eis_log_handler
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:448
eis_log_priority
eis_log_priority
Definition libeis.h:403
eis_log_set_handler
void eis_log_set_handler(struct eis *eis, eis_log_handler log_handler)
Change the log handler for this context.
eis_log_context_get_func
const char * eis_log_context_get_func(struct eis_log_context *ctx)
eis_log_set_priority
void eis_log_set_priority(struct eis *eis, enum eis_log_priority priority)
eis_log_context_get_line
unsigned int eis_log_context_get_line(struct eis_log_context *ctx)
eis_log_get_priority
enum eis_log_priority eis_log_get_priority(const struct eis *eis)
eis_log_context_get_file
const char * eis_log_context_get_file(struct eis_log_context *ctx)
EIS_LOG_PRIORITY_INFO
@ EIS_LOG_PRIORITY_INFO
Definition libeis.h:405
EIS_LOG_PRIORITY_WARNING
@ EIS_LOG_PRIORITY_WARNING
Definition libeis.h:406
EIS_LOG_PRIORITY_ERROR
@ EIS_LOG_PRIORITY_ERROR
Definition libeis.h:407
EIS_LOG_PRIORITY_DEBUG
@ EIS_LOG_PRIORITY_DEBUG
Definition libeis.h:404
eis_device_pointer_motion_absolute
void eis_device_pointer_motion_absolute(struct eis_device *device, double x, double y)
see ei_device_pointer_motion_absolute
eis_touch_set_user_data
void eis_touch_set_user_data(struct eis_touch *touch, void *user_data)
see ei_touch_set_user_data
eis_touch_get_user_data
void * eis_touch_get_user_data(struct eis_touch *touch)
see ei_touch_get_user_data
eis_device_pointer_motion
void eis_device_pointer_motion(struct eis_device *device, double x, double y)
see ei_device_pointer_motion
eis_device_scroll_stop
void eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y)
see ei_device_scroll_stop
eis_touch_ref
struct eis_touch * eis_touch_ref(struct eis_touch *touch)
see ei_touch_ref
eis_touch_cancel
void eis_touch_cancel(struct eis_touch *touch)
see ei_touch_cancel
eis_touch_unref
struct eis_touch * eis_touch_unref(struct eis_touch *touch)
see ei_touch_unref
eis_touch_up
void eis_touch_up(struct eis_touch *touch)
see ei_touch_up
eis_device_start_emulating
void eis_device_start_emulating(struct eis_device *device, uint32_t sequence)
see ei_device_start_emulating
eis_touch_motion
void eis_touch_motion(struct eis_touch *touch, double x, double y)
see ei_touch_motion
eis_device_scroll_delta
void eis_device_scroll_delta(struct eis_device *device, double x, double y)
see ei_device_scroll_delta
eis_device_touch_new
struct eis_touch * eis_device_touch_new(struct eis_device *device)
see ei_device_touch_new
eis_device_stop_emulating
void eis_device_stop_emulating(struct eis_device *device)
see ei_device_stop_emulating
eis_touch_down
void eis_touch_down(struct eis_touch *touch, double x, double y)
see ei_touch_down
eis_device_keyboard_key
void eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press)
see ei_device_keyboard_key
eis_device_scroll_discrete
void eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y)
see ei_device_scroll_discrete
eis_device_button_button
void eis_device_button_button(struct eis_device *device, uint32_t button, bool is_press)
see ei_device_button_button
eis_touch_get_device
struct eis_device * eis_touch_get_device(struct eis_touch *touch)
see ei_touch_get_device
eis_device_frame
void eis_device_frame(struct eis_device *device, uint64_t time)
see ei_device_frame
eis_device_scroll_cancel
void eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y)
see ei_device_scroll_cancel
eis_region_set_size
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()
eis_region_unref
struct eis_region * eis_region_unref(struct eis_region *region)
eis_region_add
void eis_region_add(struct eis_region *region)
Add the given region to its device.
eis_region_set_offset
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()
eis_region_get_y
uint32_t eis_region_get_y(struct eis_region *region)
eis_region_get_user_data
void * eis_region_get_user_data(struct eis_region *region)
eis_region_get_height
uint32_t eis_region_get_height(struct eis_region *region)
eis_region_contains
bool eis_region_contains(struct eis_region *region, double x, double y)
eis_region_set_user_data
void eis_region_set_user_data(struct eis_region *region, void *user_data)
eis_region_set_physical_scale
void eis_region_set_physical_scale(struct eis_region *region, double scale)
Set the physical scale for this region.
eis_region_get_width
uint32_t eis_region_get_width(struct eis_region *region)
eis_region_set_mapping_id
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.
eis_region_get_mapping_id
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...
eis_region_get_x
uint32_t eis_region_get_x(struct eis_region *region)
eis_region_get_physical_scale
double eis_region_get_physical_scale(struct eis_region *region)
eis_region_ref
struct eis_region * eis_region_ref(struct eis_region *region)
eis_seat_unref
struct eis_seat * eis_seat_unref(struct eis_seat *seat)
eis_seat_remove
void eis_seat_remove(struct eis_seat *seat)
Remove this seat and all its remaining devices.
eis_seat_get_client
struct eis_client * eis_seat_get_client(struct eis_seat *eis_seat)
eis_seat_add
void eis_seat_add(struct eis_seat *seat)
Add this seat to its client and notify the client of the seat's availability.
eis_seat_get_context
struct eis * eis_seat_get_context(struct eis_seat *seat)
eis_seat_new_device
struct eis_device * eis_seat_new_device(struct eis_seat *seat)
Create a new device on the seat.
eis_seat_ref
struct eis_seat * eis_seat_ref(struct eis_seat *seat)
eis_seat_get_name
const char * eis_seat_get_name(struct eis_seat *eis_seat)
eis_seat_get_user_data
void * eis_seat_get_user_data(struct eis_seat *eis_seat)
eis_seat_has_capability
bool eis_seat_has_capability(struct eis_seat *seat, enum eis_device_capability cap)
eis_seat_configure_capability
void eis_seat_configure_capability(struct eis_seat *seat, enum eis_device_capability cap)
Allow a capability on the seat.
eis_seat_set_user_data
void eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data)
eis_event_keyboard_get_key
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...
eis_event_touch_get_id
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,...
eis_event_touch_get_x
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 ...
eis_event_scroll_get_discrete_dy
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...
eis_event_scroll_get_dy
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,...
eis_event_scroll_get_discrete_dx
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...
eis_event_scroll_get_dx
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,...
eis_event_button_get_button
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_event_scroll_get_stop_x
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.
eis_event_keyboard_get_key_is_press
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,...
eis_event_touch_get_is_cancel
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...
eis_event_scroll_get_stop_y
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.
eis_event_touch_get_y
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 ...
eis_event_pointer_get_dy
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,...
eis_event_pointer_get_absolute_y
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,...
eis_event_pointer_get_absolute_x
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,...
eis_event_button_get_is_press
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,...
eis_event_pointer_get_dx
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,...
eis_event_emulating_get_sequence
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...
eis_backend_fd_add_client
int eis_backend_fd_add_client(struct eis *ctx)
Add a new client to a context set up with eis_setup_backend_fd().
eis_event_type_to_string
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...
eis_event_unref
struct eis_event * eis_event_unref(struct eis_event *event)
Release resources associated with this event.
eis_device_type
eis_device_type
The device type determines what the device represents.
Definition libeis.h:212
eis_client_set_user_data
void eis_client_set_user_data(struct eis_client *eis_client, void *user_data)
eis_device_capability
eis_device_capability
Definition libeis.h:221
eis_event_get_seat
struct eis_seat * eis_event_get_seat(struct eis_event *event)
eis_client_get_context
struct eis * eis_client_get_context(struct eis_client *client)
eis_event_type
eis_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition libeis.h:247
eis_keymap_type
eis_keymap_type
Definition libeis.h:234
eis_client_new_ping
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.
eis_client_connect
void eis_client_connect(struct eis_client *client)
Allow connection from the client.
eis_client_is_sender
bool eis_client_is_sender(struct eis_client *client)
Returns true if the client is a sender, false otherwise.
eis_client_new_seat
struct eis_seat * eis_client_new_seat(struct eis_client *client, const char *name)
Create a new logical seat with a given name.
eis_clock_now_func
uint64_t(* eis_clock_now_func)(struct eis *eis)
Optional override function for eis_now().
Definition libeis.h:485
eis_event_pong_get_ping
struct eis_ping * eis_event_pong_get_ping(struct eis_event *event)
Returns the associated eis_ping struct with this event.
eis_ping
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...
eis_event_get_type
enum eis_event_type eis_event_get_type(struct eis_event *event)
eis_get_fd
int eis_get_fd(struct eis *eis)
libeis keeps a single file descriptor for all events.
eis_new
struct eis * eis_new(void *user_data)
Create a new libeis context with a refcount of 1.
eis_ping_set_user_data
void eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data)
Set a custom data pointer for this struct.
eis_clock_set_now_func
void eis_clock_set_now_func(struct eis *, eis_clock_now_func func)
Override the function that returns the current time eis_now().
eis_client_get_name
const char * eis_client_get_name(struct eis_client *client)
Return the name set by this client.
eis_ref
struct eis * eis_ref(struct eis *eis)
eis_event_get_time
uint64_t eis_event_get_time(struct eis_event *event)
Return the time for the event of type EIS_EVENT_FRAME in microseconds.
eis_client_get_user_data
void * eis_client_get_user_data(struct eis_client *eis_client)
eis_get_event
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.
eis_event_get_device
struct eis_device * eis_event_get_device(struct eis_event *event)
Return the device from this event.
eis_set_user_data
void eis_set_user_data(struct eis *eis, void *user_data)
eis_peek_event
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...
eis_client_disconnect
void eis_client_disconnect(struct eis_client *client)
Disconnect this client.
eis_client_unref
struct eis_client * eis_client_unref(struct eis_client *client)
eis_unref
struct eis * eis_unref(struct eis *eis)
eis_ping_unref
struct eis_ping * eis_ping_unref(struct eis_ping *eis_ping)
Decrease the refcount of this struct by one.
eis_ping_get_id
uint64_t eis_ping_get_id(struct eis_ping *ping)
Return a unique, increasing id for this struct.
eis_now
uint64_t eis_now(struct eis *eis)
eis_setup_backend_socket
int eis_setup_backend_socket(struct eis *ctx, const char *path)
Initialize the context with a UNIX socket name.
eis_event_get_client
struct eis_client * eis_event_get_client(struct eis_event *event)
eis_ping_get_user_data
void * eis_ping_get_user_data(struct eis_ping *eis_ping)
Return the custom data pointer for this struct.
eis_client_ref
struct eis_client * eis_client_ref(struct eis_client *client)
eis_setup_backend_fd
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...
eis_ping_ref
struct eis_ping * eis_ping_ref(struct eis_ping *eis_ping)
Increase the refcount of this struct by one.
eis_dispatch
void eis_dispatch(struct eis *eis)
Main event dispatching function.
eis_get_user_data
void * eis_get_user_data(struct eis *eis)
eis_event_seat_has_capability
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.
EIS_DEVICE_TYPE_VIRTUAL
@ EIS_DEVICE_TYPE_VIRTUAL
Definition libeis.h:213
EIS_DEVICE_TYPE_PHYSICAL
@ EIS_DEVICE_TYPE_PHYSICAL
Definition libeis.h:214
EIS_DEVICE_CAP_POINTER
@ EIS_DEVICE_CAP_POINTER
Definition libeis.h:222
EIS_DEVICE_CAP_SCROLL
@ EIS_DEVICE_CAP_SCROLL
Definition libeis.h:226
EIS_DEVICE_CAP_TOUCH
@ EIS_DEVICE_CAP_TOUCH
Definition libeis.h:225
EIS_DEVICE_CAP_KEYBOARD
@ EIS_DEVICE_CAP_KEYBOARD
Definition libeis.h:224
EIS_DEVICE_CAP_BUTTON
@ EIS_DEVICE_CAP_BUTTON
Definition libeis.h:227
EIS_DEVICE_CAP_POINTER_ABSOLUTE
@ EIS_DEVICE_CAP_POINTER_ABSOLUTE
Definition libeis.h:223
EIS_EVENT_TOUCH_UP
@ EIS_EVENT_TOUCH_UP
Event for a single touch released from the device's logical surface.
Definition libeis.h:378
EIS_EVENT_SCROLL_STOP
@ EIS_EVENT_SCROLL_STOP
An ongoing scroll sequence stopped.
Definition libeis.h:351
EIS_EVENT_DEVICE_START_EMULATING
@ EIS_EVENT_DEVICE_START_EMULATING
The client is about to send events for a device.
Definition libeis.h:321
EIS_EVENT_BUTTON_BUTTON
@ EIS_EVENT_BUTTON_BUTTON
A button press or release event.
Definition libeis.h:342
EIS_EVENT_PONG
@ EIS_EVENT_PONG
Returned in response to eis_ping().
Definition libeis.h:277
EIS_EVENT_CLIENT_DISCONNECT
@ EIS_EVENT_CLIENT_DISCONNECT
The client has disconnected, any pending requests for this client should be discarded.
Definition libeis.h:259
EIS_EVENT_DEVICE_CLOSED
@ EIS_EVENT_DEVICE_CLOSED
The client no longer listens to events from this device.
Definition libeis.h:272
EIS_EVENT_TOUCH_DOWN
@ EIS_EVENT_TOUCH_DOWN
Event for a single touch set down on the device's logical surface.
Definition libeis.h:373
EIS_EVENT_POINTER_MOTION
@ EIS_EVENT_POINTER_MOTION
A relative motion event with delta coordinates in logical pixels or mm, depending on the device type.
Definition libeis.h:333
EIS_EVENT_SYNC
@ EIS_EVENT_SYNC
This event represents a synchronization request (ping) from the client implementation.
Definition libeis.h:291
EIS_EVENT_FRAME
@ EIS_EVENT_FRAME
"Hardware" frame event.
Definition libeis.h:303
EIS_EVENT_DEVICE_STOP_EMULATING
@ EIS_EVENT_DEVICE_STOP_EMULATING
Stop emulating events on this device, see EIS_EVENT_DEVICE_START_EMULATING.
Definition libeis.h:325
EIS_EVENT_SCROLL_DELTA
@ EIS_EVENT_SCROLL_DELTA
A vertical and/or horizontal scroll event with logical-pixels or mm precision, depending on the devic...
Definition libeis.h:347
EIS_EVENT_SCROLL_CANCEL
@ EIS_EVENT_SCROLL_CANCEL
An ongoing scroll sequence was cancelled.
Definition libeis.h:355
EIS_EVENT_TOUCH_MOTION
@ EIS_EVENT_TOUCH_MOTION
Event for a single currently-down touch changing position (or other properties).
Definition libeis.h:383
EIS_EVENT_CLIENT_CONNECT
@ EIS_EVENT_CLIENT_CONNECT
A client has connected.
Definition libeis.h:254
EIS_EVENT_KEYBOARD_KEY
@ EIS_EVENT_KEYBOARD_KEY
A key press or release event.
Definition libeis.h:365
EIS_EVENT_SCROLL_DISCRETE
@ EIS_EVENT_SCROLL_DISCRETE
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps,...
Definition libeis.h:360
EIS_EVENT_SEAT_BIND
@ EIS_EVENT_SEAT_BIND
The client wants to bind or unbind a capability on this seat.
Definition libeis.h:266
EIS_EVENT_POINTER_MOTION_ABSOLUTE
@ EIS_EVENT_POINTER_MOTION_ABSOLUTE
An absolute motion event with absolute position within the device's regions or size,...
Definition libeis.h:338
EIS_KEYMAP_TYPE_XKB
@ EIS_KEYMAP_TYPE_XKB
Definition libeis.h:235
eis_client
eis_device
eis_event
eis_keymap
eis_ping
A callback struct returned by eis_new_ping() to handle roundtrips to the client.
eis_region
Regions are only available on devices of type EIS_DEVICE_TYPE_VIRTUAL.
eis_seat
eis_touch
eis