libei: doc/api/libeis.h Source File

libei 1.6.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#pragma once
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <stdbool.h>
32#include <stddef.h>
33#include <stdint.h>
34#include <sys/types.h>
35
115
120
124struct eis;
128struct eis_client;
132struct eis_device;
136struct eis_seat;
140struct eis_event;
144struct eis_keymap;
148struct eis_touch;
149
158struct eis_ping;
159
188struct eis_region;
189
212 enum eis_device_type { EIS_DEVICE_TYPE_VIRTUAL = 1, EIS_DEVICE_TYPE_PHYSICAL };
213
218 enum eis_device_capability {
219 EIS_DEVICE_CAP_POINTER = (1 << 0),
220 EIS_DEVICE_CAP_POINTER_ABSOLUTE = (1 << 1),
221 EIS_DEVICE_CAP_KEYBOARD = (1 << 2),
222 EIS_DEVICE_CAP_TOUCH = (1 << 3),
223 EIS_DEVICE_CAP_SCROLL = (1 << 4),
224 EIS_DEVICE_CAP_BUTTON = (1 << 5),
228 EIS_DEVICE_CAP_TEXT = (1 << 6),
229};
230
235 enum eis_keymap_type {
236 EIS_KEYMAP_TYPE_XKB = 1,
237};
238
248 enum eis_event_type {
255 EIS_EVENT_CLIENT_CONNECT = 1,
260 EIS_EVENT_CLIENT_DISCONNECT,
261
267 EIS_EVENT_SEAT_BIND,
268
273 EIS_EVENT_DEVICE_CLOSED,
274
287 EIS_EVENT_DEVICE_READY,
288
295 EIS_EVENT_SEAT_DEVICE_REQUESTED,
296
300 EIS_EVENT_PONG = 90,
301
314 EIS_EVENT_SYNC,
315
326 EIS_EVENT_FRAME = 100,
327
344 EIS_EVENT_DEVICE_START_EMULATING = 200,
348 EIS_EVENT_DEVICE_STOP_EMULATING,
349
350 /* These events are only generated on a receiving EIS context */
351
356 EIS_EVENT_POINTER_MOTION = 300,
361 EIS_EVENT_POINTER_MOTION_ABSOLUTE = 400,
365 EIS_EVENT_BUTTON_BUTTON = 500,
370 EIS_EVENT_SCROLL_DELTA = 600,
374 EIS_EVENT_SCROLL_STOP,
378 EIS_EVENT_SCROLL_CANCEL,
383 EIS_EVENT_SCROLL_DISCRETE,
384
388 EIS_EVENT_KEYBOARD_KEY = 700,
389
396 EIS_EVENT_TOUCH_DOWN = 800,
401 EIS_EVENT_TOUCH_UP,
406 EIS_EVENT_TOUCH_MOTION,
407
413 EIS_EVENT_TEXT_KEYSYM = 900,
414
420 EIS_EVENT_TEXT_UTF8,
421};
422
428 const char *eis_event_type_to_string(enum eis_event_type);
429
433struct eis *
434eis_new(void *user_data);
435
447 enum eis_flag {
458 EIS_FLAG_DEVICE_READY = 1,
459};
460
480int
481eis_set_flag(struct eis *eis, enum eis_flag flag);
482
486 enum eis_log_priority {
487 EIS_LOG_PRIORITY_DEBUG = 10,
488 EIS_LOG_PRIORITY_INFO = 20,
489 EIS_LOG_PRIORITY_WARNING = 30,
490 EIS_LOG_PRIORITY_ERROR = 40,
491};
492
496struct eis_log_context;
497
502unsigned int
503eis_log_context_get_line(struct eis_log_context *ctx);
504
509const char *
510eis_log_context_get_file(struct eis_log_context *ctx);
511
516const char *
517eis_log_context_get_func(struct eis_log_context *ctx);
518
531 typedef void (*eis_log_handler)(struct eis *eis,
532 enum eis_log_priority priority,
533 const char *message,
534 struct eis_log_context *ctx);
545void
546eis_log_set_handler(struct eis *eis, eis_log_handler log_handler);
547
551void
552eis_log_set_priority(struct eis *eis, enum eis_log_priority priority);
553
557enum eis_log_priority
558eis_log_get_priority(const struct eis *eis);
559
568 typedef uint64_t (*eis_clock_now_func)(struct eis *eis);
569
575void
576eis_clock_set_now_func(struct eis *, eis_clock_now_func func);
577
578struct eis *
579eis_ref(struct eis *eis);
580
581struct eis *
582eis_unref(struct eis *eis);
583
584void *
585eis_get_user_data(struct eis *eis);
586
587void
588eis_set_user_data(struct eis *eis, void *user_data);
589
598int
599eis_setup_backend_fd(struct eis *ctx);
600
606int
607eis_backend_fd_add_client(struct eis *ctx);
608
618int
619eis_setup_backend_socket(struct eis *ctx, const char *path);
620
629pid_t
630eis_backend_socket_get_client_pid(struct eis_client *client);
631
638int
639eis_get_fd(struct eis *eis);
640
650void
651eis_dispatch(struct eis *eis);
652
665uint64_t
666eis_ping_get_id(struct eis_ping *ping);
667
676struct eis_ping *
677eis_ping_ref(struct eis_ping *eis_ping);
678
688struct eis_ping *
689eis_ping_unref(struct eis_ping *eis_ping);
690
698void
699eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data);
700
707void *
708eis_ping_get_user_data(struct eis_ping *eis_ping);
709
722void
723eis_ping(struct eis_ping *ping);
724
735struct eis_event *
736eis_get_event(struct eis *eis);
737
754struct eis_event *
755eis_peek_event(struct eis *eis);
756
765struct eis_event *
766eis_event_ref(struct eis_event *event);
767
777struct eis_event *
778eis_event_unref(struct eis_event *event);
779
780enum eis_event_type
781eis_event_get_type(struct eis_event *event);
782
783struct eis_client *
784eis_event_get_client(struct eis_event *event);
785
786struct eis_seat *
787eis_event_get_seat(struct eis_event *event);
788
798struct eis_ping *
799eis_event_pong_get_ping(struct eis_event *event);
800
809bool
810eis_event_seat_has_capability(struct eis_event *event, enum eis_device_capability cap);
811
818struct eis_device *
819eis_event_get_device(struct eis_event *event);
820
830uint64_t
831eis_event_get_time(struct eis_event *event);
832
842struct eis_ping *
843eis_client_new_ping(struct eis_client *client);
844
845struct eis_client *
846eis_client_ref(struct eis_client *client);
847
848struct eis_client *
849eis_client_unref(struct eis_client *client);
850
851void *
852eis_client_get_user_data(struct eis_client *eis_client);
853
854void
855eis_client_set_user_data(struct eis_client *eis_client, void *user_data);
856
857struct eis *
858eis_client_get_context(struct eis_client *client);
859
865bool
866eis_client_is_sender(struct eis_client *client);
867
872const char *
873eis_client_get_name(struct eis_client *client);
874
884void
885eis_client_connect(struct eis_client *client);
886
895void
896eis_client_disconnect(struct eis_client *client);
897
910struct eis_seat *
911eis_client_new_seat(struct eis_client *client, const char *name);
912
916struct eis_seat *
917eis_seat_ref(struct eis_seat *seat);
918
922struct eis_seat *
923eis_seat_unref(struct eis_seat *seat);
924
928struct eis_client *
929eis_seat_get_client(struct eis_seat *eis_seat);
930
934const char *
935eis_seat_get_name(struct eis_seat *eis_seat);
936
940void *
941eis_seat_get_user_data(struct eis_seat *eis_seat);
942
946void
947eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data);
948
952bool
953eis_seat_has_capability(struct eis_seat *seat, enum eis_device_capability cap);
954
967void
968eis_seat_configure_capability(struct eis_seat *seat, enum eis_device_capability cap);
969
976void
977eis_seat_add(struct eis_seat *seat);
978
984void
985eis_seat_remove(struct eis_seat *seat);
986
990struct eis *
991eis_seat_get_context(struct eis_seat *seat);
992
996struct eis *
997eis_device_get_context(struct eis_device *device);
998
1002struct eis_client *
1003eis_device_get_client(struct eis_device *device);
1004
1008struct eis_seat *
1009eis_device_get_seat(struct eis_device *device);
1010
1014struct eis_device *
1015eis_device_ref(struct eis_device *device);
1016
1020struct eis_device *
1021eis_device_unref(struct eis_device *device);
1022
1026void *
1027eis_device_get_user_data(struct eis_device *eis_device);
1028
1032void
1033eis_device_set_user_data(struct eis_device *eis_device, void *user_data);
1034
1042const char *
1043eis_device_get_name(struct eis_device *device);
1044
1048bool
1049eis_device_has_capability(struct eis_device *device, enum eis_device_capability cap);
1050
1057uint32_t
1058eis_device_get_width(struct eis_device *device);
1059
1066uint32_t
1067eis_device_get_height(struct eis_device *device);
1068
1088struct eis_device *
1089eis_seat_new_device(struct eis_seat *seat);
1090
1099void
1100eis_device_configure_type(struct eis_device *device, enum eis_device_type type);
1101
1105enum eis_device_type
1106eis_device_get_type(struct eis_device *device);
1107
1111void
1112eis_device_configure_name(struct eis_device *device, const char *name);
1113
1117void
1118eis_device_configure_capability(struct eis_device *device, enum eis_device_capability cap);
1119
1134void
1135eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height);
1136
1149struct eis_region *
1150eis_device_new_region(struct eis_device *device);
1151
1157void
1158eis_region_set_size(struct eis_region *region, uint32_t w, uint32_t h);
1159
1165void
1166eis_region_set_offset(struct eis_region *region, uint32_t x, uint32_t y);
1167
1180void
1181eis_region_set_physical_scale(struct eis_region *region, double scale);
1182
1206void
1207eis_region_set_mapping_id(struct eis_region *region, const char *mapping_id);
1208
1227const char *
1228eis_region_get_mapping_id(struct eis_region *region);
1229
1238void
1239eis_region_add(struct eis_region *region);
1240
1260struct eis_region *
1261eis_device_get_region(struct eis_device *device, size_t index);
1262
1271struct eis_region *
1272eis_device_get_region_at(struct eis_device *device, double x, double y);
1273
1277struct eis_region *
1278eis_region_ref(struct eis_region *region);
1279
1283struct eis_region *
1284eis_region_unref(struct eis_region *region);
1285
1289void *
1290eis_region_get_user_data(struct eis_region *region);
1291
1295void
1296eis_region_set_user_data(struct eis_region *region, void *user_data);
1297
1301uint32_t
1302eis_region_get_x(struct eis_region *region);
1303
1307uint32_t
1308eis_region_get_y(struct eis_region *region);
1309
1313uint32_t
1314eis_region_get_width(struct eis_region *region);
1315
1319uint32_t
1320eis_region_get_height(struct eis_region *region);
1321
1325double
1326eis_region_get_physical_scale(struct eis_region *region);
1327
1333bool
1334eis_region_contains(struct eis_region *region, double x, double y);
1335
1345void
1346eis_device_add(struct eis_device *device);
1347
1355void
1356eis_device_remove(struct eis_device *device);
1357
1379void
1380eis_device_pause(struct eis_device *device);
1381
1390void
1391eis_device_resume(struct eis_device *device);
1392
1412struct eis_keymap *
1413eis_device_new_keymap(struct eis_device *device, enum eis_keymap_type type, int fd, size_t size);
1414
1430void
1431eis_keymap_add(struct eis_keymap *keymap);
1432
1437size_t
1438eis_keymap_get_size(struct eis_keymap *keymap);
1439
1446enum eis_keymap_type
1447eis_keymap_get_type(struct eis_keymap *keymap);
1448
1456int
1457eis_keymap_get_fd(struct eis_keymap *keymap);
1458
1462struct eis_keymap *
1463eis_keymap_ref(struct eis_keymap *keymap);
1464
1468struct eis_keymap *
1469eis_keymap_unref(struct eis_keymap *keymap);
1470
1474void *
1475eis_keymap_get_user_data(struct eis_keymap *eis_keymap);
1476
1480void
1481eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data);
1482
1488struct eis_device *
1489eis_keymap_get_device(struct eis_keymap *keymap);
1490
1498struct eis_keymap *
1499eis_device_keyboard_get_keymap(struct eis_device *device);
1500
1522void
1523eis_device_keyboard_send_xkb_modifiers(struct eis_device *device,
1524 uint32_t depressed,
1525 uint32_t latched,
1526 uint32_t locked,
1527 uint32_t group);
1528
1536void
1537eis_device_text_keysym(struct eis_device *device, uint32_t keysym, bool is_press);
1538
1546void
1547eis_device_text_utf8(struct eis_device *device, const char *utf8);
1548
1556void
1557eis_device_text_utf8_with_length(struct eis_device *device, const char *text, size_t length);
1558
1564void
1565eis_device_start_emulating(struct eis_device *device, uint32_t sequence);
1566
1572void
1573eis_device_stop_emulating(struct eis_device *device);
1574
1580void
1581eis_device_frame(struct eis_device *device, uint64_t time);
1582
1588void
1589eis_device_pointer_motion(struct eis_device *device, double x, double y);
1590
1596void
1597eis_device_pointer_motion_absolute(struct eis_device *device, double x, double y);
1598
1604void
1605eis_device_button_button(struct eis_device *device, uint32_t button, bool is_press);
1606
1612void
1613eis_device_scroll_delta(struct eis_device *device, double x, double y);
1614
1620void
1621eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
1622
1628void
1629eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
1630
1636void
1637eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
1638
1644void
1645eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press);
1646
1652struct eis_touch *
1653eis_device_touch_new(struct eis_device *device);
1654
1660void
1661eis_touch_down(struct eis_touch *touch, double x, double y);
1662
1668void
1669eis_touch_motion(struct eis_touch *touch, double x, double y);
1670
1676void
1677eis_touch_up(struct eis_touch *touch);
1678
1684void
1685eis_touch_cancel(struct eis_touch *touch);
1686
1692struct eis_touch *
1693eis_touch_ref(struct eis_touch *touch);
1694
1700struct eis_touch *
1701eis_touch_unref(struct eis_touch *touch);
1702
1708void
1709eis_touch_set_user_data(struct eis_touch *touch, void *user_data);
1710
1716void *
1717eis_touch_get_user_data(struct eis_touch *touch);
1718
1724struct eis_device *
1725eis_touch_get_device(struct eis_touch *touch);
1726
1735uint32_t
1736eis_event_emulating_get_sequence(struct eis_event *event);
1737
1744double
1745eis_event_pointer_get_dx(struct eis_event *event);
1746
1753double
1754eis_event_pointer_get_dy(struct eis_event *event);
1755
1762double
1763eis_event_pointer_get_absolute_x(struct eis_event *event);
1764
1771double
1772eis_event_pointer_get_absolute_y(struct eis_event *event);
1773
1780uint32_t
1781eis_event_button_get_button(struct eis_event *event);
1782
1789bool
1790eis_event_button_get_is_press(struct eis_event *event);
1791
1798double
1799eis_event_scroll_get_dx(struct eis_event *event);
1800
1807double
1808eis_event_scroll_get_dy(struct eis_event *event);
1809
1819bool
1820eis_event_scroll_get_stop_x(struct eis_event *event);
1821
1831bool
1832eis_event_scroll_get_stop_y(struct eis_event *event);
1833
1840int32_t
1841eis_event_scroll_get_discrete_dx(struct eis_event *event);
1842
1849int32_t
1850eis_event_scroll_get_discrete_dy(struct eis_event *event);
1851
1858uint32_t
1859eis_event_keyboard_get_key(struct eis_event *event);
1860
1867bool
1868eis_event_keyboard_get_key_is_press(struct eis_event *event);
1869
1882uint32_t
1883eis_event_touch_get_id(struct eis_event *event);
1884
1892double
1893eis_event_touch_get_x(struct eis_event *event);
1894
1902double
1903eis_event_touch_get_y(struct eis_event *event);
1904
1915bool
1916eis_event_touch_get_is_cancel(struct eis_event *event);
1917
1926uint32_t
1927eis_event_text_get_keysym(struct eis_event *event);
1928
1938bool
1939eis_event_text_get_keysym_is_press(struct eis_event *event);
1940
1949const char *
1950eis_event_text_get_utf8(struct eis_event *event);
1951
1959uint64_t
1960eis_now(struct eis *eis);
1961
1965
1966#ifdef __cplusplus
1967}
1968#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:531
eis_log_priority
eis_log_priority
Definition libeis.h:486
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:488
EIS_LOG_PRIORITY_WARNING
@ EIS_LOG_PRIORITY_WARNING
Definition libeis.h:489
EIS_LOG_PRIORITY_ERROR
@ EIS_LOG_PRIORITY_ERROR
Definition libeis.h:490
EIS_LOG_PRIORITY_DEBUG
@ EIS_LOG_PRIORITY_DEBUG
Definition libeis.h:487
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_device_text_keysym
void eis_device_text_keysym(struct eis_device *device, uint32_t keysym, bool is_press)
see ei_device_text_keysym
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_text_utf8_with_length
void eis_device_text_utf8_with_length(struct eis_device *device, const char *text, size_t length)
see ei_device_text_utf8_with_length
eis_device_start_emulating
void eis_device_start_emulating(struct eis_device *device, uint32_t sequence)
see ei_device_start_emulating
eis_device_text_utf8
void eis_device_text_utf8(struct eis_device *device, const char *utf8)
see ei_device_text_utf8
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_text_get_keysym
uint32_t eis_event_text_get_keysym(struct eis_event *event)
For an event of type EIS_EVENT_TEXT_KEYSYM return the XKB-compatible keysym.
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_text_get_utf8
const char * eis_event_text_get_utf8(struct eis_event *event)
For an event of type EIS_EVENT_TEXT_UTF8 return the zero-terminated UTF8 string.
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_text_get_keysym_is_press
bool eis_event_text_get_keysym_is_press(struct eis_event *event)
For an event of type EIS_EVENT_TEXT_KEYSYM return true if the event is a logical key down for the key...
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)
Decrease the refcount of this struct by one.
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:218
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_set_flag
int eis_set_flag(struct eis *eis, enum eis_flag flag)
Change the behavior of the context according to the given flag.
eis_flag
eis_flag
Context flags to enable EIS-specific behaviors.
Definition libeis.h:447
eis_event_type
eis_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition libeis.h:248
eis_backend_socket_get_client_pid
pid_t eis_backend_socket_get_client_pid(struct eis_client *client)
Return the pid of the client.
eis_keymap_type
eis_keymap_type
Definition libeis.h:235
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:568
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_event_ref
struct eis_event * eis_event_ref(struct eis_event *event)
Increase the refcount of this struct by one.
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 or EIS_EVENT_SEAT_DEVICE_REQUESTED, return the capabilities ...
EIS_DEVICE_TYPE_VIRTUAL
@ EIS_DEVICE_TYPE_VIRTUAL
Definition libeis.h:212
EIS_DEVICE_TYPE_PHYSICAL
@ EIS_DEVICE_TYPE_PHYSICAL
Definition libeis.h:212
EIS_DEVICE_CAP_TEXT
@ EIS_DEVICE_CAP_TEXT
Definition libeis.h:228
EIS_DEVICE_CAP_POINTER
@ EIS_DEVICE_CAP_POINTER
Definition libeis.h:219
EIS_DEVICE_CAP_SCROLL
@ EIS_DEVICE_CAP_SCROLL
Definition libeis.h:223
EIS_DEVICE_CAP_TOUCH
@ EIS_DEVICE_CAP_TOUCH
Definition libeis.h:222
EIS_DEVICE_CAP_KEYBOARD
@ EIS_DEVICE_CAP_KEYBOARD
Definition libeis.h:221
EIS_DEVICE_CAP_BUTTON
@ EIS_DEVICE_CAP_BUTTON
Definition libeis.h:224
EIS_DEVICE_CAP_POINTER_ABSOLUTE
@ EIS_DEVICE_CAP_POINTER_ABSOLUTE
Definition libeis.h:220
EIS_FLAG_DEVICE_READY
@ EIS_FLAG_DEVICE_READY
If set, libeis will announce ei_device protocol version 3 or later.
Definition libeis.h:458
EIS_EVENT_TOUCH_UP
@ EIS_EVENT_TOUCH_UP
Event for a single touch released from the device's logical surface.
Definition libeis.h:401
EIS_EVENT_SCROLL_STOP
@ EIS_EVENT_SCROLL_STOP
An ongoing scroll sequence stopped.
Definition libeis.h:374
EIS_EVENT_TEXT_KEYSYM
@ EIS_EVENT_TEXT_KEYSYM
A key sym logical press or release event.
Definition libeis.h:413
EIS_EVENT_DEVICE_START_EMULATING
@ EIS_EVENT_DEVICE_START_EMULATING
The client is about to send events for a device.
Definition libeis.h:344
EIS_EVENT_BUTTON_BUTTON
@ EIS_EVENT_BUTTON_BUTTON
A button press or release event.
Definition libeis.h:365
EIS_EVENT_PONG
@ EIS_EVENT_PONG
Returned in response to eis_ping().
Definition libeis.h:300
EIS_EVENT_CLIENT_DISCONNECT
@ EIS_EVENT_CLIENT_DISCONNECT
The client has disconnected, any pending requests for this client should be discarded.
Definition libeis.h:260
EIS_EVENT_DEVICE_READY
@ EIS_EVENT_DEVICE_READY
The client has completed configuration of the device (if any) and the caller may call eis_device_resu...
Definition libeis.h:287
EIS_EVENT_DEVICE_CLOSED
@ EIS_EVENT_DEVICE_CLOSED
The client no longer listens to events from this device.
Definition libeis.h:273
EIS_EVENT_TEXT_UTF8
@ EIS_EVENT_TEXT_UTF8
A UTF-8 text event.
Definition libeis.h:420
EIS_EVENT_TOUCH_DOWN
@ EIS_EVENT_TOUCH_DOWN
Event for a single touch set down on the device's logical surface.
Definition libeis.h:396
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:356
EIS_EVENT_SYNC
@ EIS_EVENT_SYNC
This event represents a synchronization request (ping) from the client implementation.
Definition libeis.h:314
EIS_EVENT_FRAME
@ EIS_EVENT_FRAME
"Hardware" frame event.
Definition libeis.h:326
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:348
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:370
EIS_EVENT_SCROLL_CANCEL
@ EIS_EVENT_SCROLL_CANCEL
An ongoing scroll sequence was cancelled.
Definition libeis.h:378
EIS_EVENT_TOUCH_MOTION
@ EIS_EVENT_TOUCH_MOTION
Event for a single currently-down touch changing position (or other properties).
Definition libeis.h:406
EIS_EVENT_CLIENT_CONNECT
@ EIS_EVENT_CLIENT_CONNECT
A client has connected.
Definition libeis.h:255
EIS_EVENT_KEYBOARD_KEY
@ EIS_EVENT_KEYBOARD_KEY
A key press or release event.
Definition libeis.h:388
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:383
EIS_EVENT_SEAT_BIND
@ EIS_EVENT_SEAT_BIND
The client wants to bind or unbind a capability on this seat.
Definition libeis.h:267
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:361
EIS_EVENT_SEAT_DEVICE_REQUESTED
@ EIS_EVENT_SEAT_DEVICE_REQUESTED
The client requested a device with the given capabilities on this seat.
Definition libeis.h:295
EIS_KEYMAP_TYPE_XKB
@ EIS_KEYMAP_TYPE_XKB
Definition libeis.h:236
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