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;
157struct eis_ping;
158
187struct eis_region;
188
212
237
255
263
604
611
615struct eis *
616eis_new(void *user_data);
617
642
662int
663eis_set_flag(struct eis *eis, enum eis_flag flag);
664
674
678struct eis_log_context;
679
684unsigned int
685eis_log_context_get_line(struct eis_log_context *ctx);
686
691const char *
692eis_log_context_get_file(struct eis_log_context *ctx);
693
698const char *
699eis_log_context_get_func(struct eis_log_context *ctx);
700
713typedef void (*eis_log_handler)(struct eis *eis,
714 enum eis_log_priority priority,
715 const char *message,
716 struct eis_log_context *ctx);
727void
729
733void
735
741
750typedef uint64_t (*eis_clock_now_func)(struct eis *eis);
751
757void
759
760struct eis *
761eis_ref(struct eis *eis);
762
763struct eis *
765
766void *
768
769void
770eis_set_user_data(struct eis *eis, void *user_data);
771
780int
782
788int
790
800int
801eis_setup_backend_socket(struct eis *ctx, const char *path);
802
811pid_t
813
820int
822
832void
834
847uint64_t
849
858struct eis_ping *
860
870struct eis_ping *
872
880void
881eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data);
882
889void *
891
904void
905eis_ping(struct eis_ping *ping);
906
917struct eis_event *
919
936struct eis_event *
938
947struct eis_event *
949
959struct eis_event *
961
964
965struct eis_client *
967
968struct eis_seat *
970
980struct eis_ping *
982
991bool
993
1000struct eis_device *
1002
1012uint64_t
1014
1024struct eis_ping *
1026
1027struct eis_client *
1029
1030struct eis_client *
1032
1033void *
1035
1036void
1038
1039struct eis *
1041
1047bool
1049
1054const char *
1056
1066void
1068
1077void
1079
1092struct eis_seat *
1093eis_client_new_seat(struct eis_client *client, const char *name);
1094
1098struct eis_seat *
1100
1104struct eis_seat *
1106
1110struct eis_client *
1112
1116const char *
1118
1122void *
1124
1128void
1129eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data);
1130
1134bool
1136
1149void
1151
1158void
1160
1166void
1168
1172struct eis *
1174
1178struct eis *
1180
1184struct eis_client *
1186
1190struct eis_seat *
1192
1196struct eis_device *
1198
1202struct eis_device *
1204
1208void *
1210
1214void
1216
1224const char *
1226
1230bool
1232
1239uint32_t
1241
1248uint32_t
1250
1271struct eis_device *
1273
1282void
1284
1288enum eis_device_type
1290
1294void
1295eis_device_configure_name(struct eis_device *device, const char *name);
1296
1300void
1302
1317void
1318eis_device_configure_size(struct eis_device *device, uint32_t width, uint32_t height);
1319
1332struct eis_region *
1334
1340void
1341eis_region_set_size(struct eis_region *region, uint32_t w, uint32_t h);
1342
1348void
1349eis_region_set_offset(struct eis_region *region, uint32_t x, uint32_t y);
1350
1363void
1364eis_region_set_physical_scale(struct eis_region *region, double scale);
1365
1389void
1390eis_region_set_mapping_id(struct eis_region *region, const char *mapping_id);
1391
1410const char *
1412
1421void
1423
1443struct eis_region *
1444eis_device_get_region(struct eis_device *device, size_t index);
1445
1454struct eis_region *
1455eis_device_get_region_at(struct eis_device *device, double x, double y);
1456
1460struct eis_region *
1462
1466struct eis_region *
1468
1472void *
1474
1478void
1479eis_region_set_user_data(struct eis_region *region, void *user_data);
1480
1484uint32_t
1486
1490uint32_t
1492
1496uint32_t
1498
1502uint32_t
1504
1508double
1510
1516bool
1517eis_region_contains(struct eis_region *region, double x, double y);
1518
1528void
1530
1538void
1540
1563void
1565
1574void
1576
1596struct eis_keymap *
1597eis_device_new_keymap(struct eis_device *device, enum eis_keymap_type type, int fd, size_t size);
1598
1614void
1616
1621size_t
1623
1630enum eis_keymap_type
1632
1640int
1642
1646struct eis_keymap *
1648
1652struct eis_keymap *
1654
1658void *
1660
1664void
1666
1672struct eis_device *
1674
1682struct eis_keymap *
1684
1706void
1708 uint32_t depressed,
1709 uint32_t latched,
1710 uint32_t locked,
1711 uint32_t group);
1712
1720void
1721eis_device_text_keysym(struct eis_device *device, uint32_t keysym, bool is_press);
1722
1730void
1731eis_device_text_utf8(struct eis_device *device, const char *utf8);
1732
1740void
1741eis_device_text_utf8_with_length(struct eis_device *device, const char *text, size_t length);
1742
1748void
1749eis_device_start_emulating(struct eis_device *device, uint32_t sequence);
1750
1756void
1758
1764void
1765eis_device_frame(struct eis_device *device, uint64_t time);
1766
1772void
1773eis_device_pointer_motion(struct eis_device *device, double x, double y);
1774
1780void
1781eis_device_pointer_motion_absolute(struct eis_device *device, double x, double y);
1782
1788void
1789eis_device_button_button(struct eis_device *device, uint32_t button, bool is_press);
1790
1796void
1797eis_device_scroll_delta(struct eis_device *device, double x, double y);
1798
1804void
1805eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
1806
1812void
1813eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
1814
1820void
1821eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
1822
1828void
1829eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press);
1830
1836struct eis_touch *
1838
1844void
1845eis_touch_down(struct eis_touch *touch, double x, double y);
1846
1852void
1853eis_touch_motion(struct eis_touch *touch, double x, double y);
1854
1860void
1862
1868void
1870
1876struct eis_touch *
1878
1884struct eis_touch *
1886
1892void
1893eis_touch_set_user_data(struct eis_touch *touch, void *user_data);
1894
1900void *
1902
1908struct eis_device *
1910
1924void
1925eis_device_swipe_begin(struct eis_device *device, uint32_t nfingers);
1926
1934void
1935eis_device_swipe_update(struct eis_device *device, double dx, double dy);
1936
1944void
1946
1959void
1961
1974void
1976
1990void
1991eis_device_pinch_begin(struct eis_device *device, uint32_t nfingers);
1992
2001void
2003 double dx,
2004 double dy,
2005 double scale,
2006 double rotation);
2007
2015void
2017
2030void
2032
2045void
2047
2061void
2062eis_device_hold_begin(struct eis_device *device, uint32_t nfingers);
2063
2071void
2073
2086void
2088
2103void
2105
2118void
2120
2133void
2135
2150void
2152
2167void
2169
2182void
2184
2197void
2199
2214void
2215eis_device_stylus_motion(struct eis_device *device, double x, double y);
2216
2233void
2234eis_device_stylus_pressure(struct eis_device *device, double pressure);
2235
2252void
2253eis_device_stylus_distance(struct eis_device *device, double distance);
2254
2272void
2273eis_device_stylus_tilt(struct eis_device *device, double tilt_x, double tilt_y);
2274
2291void
2292eis_device_stylus_rotation(struct eis_device *device, double rotation);
2293
2310void
2311eis_device_stylus_airbrush_flow(struct eis_device *device, double flow);
2312
2325void
2327
2336uint32_t
2338
2345double
2347
2354double
2356
2363double
2365
2372double
2374
2381uint32_t
2383
2390bool
2392
2399double
2401
2408double
2410
2420bool
2422
2432bool
2434
2441int32_t
2443
2450int32_t
2452
2459uint32_t
2461
2468bool
2470
2483uint32_t
2485
2493double
2495
2503double
2505
2516bool
2518
2528uint32_t
2530
2540double
2542
2552double
2554
2563bool
2565
2575uint32_t
2577
2587double
2589
2599double
2601
2610double
2612
2621double
2623
2632bool
2634
2644uint32_t
2646
2655bool
2657
2666uint32_t
2668
2678bool
2680
2689const char *
2691
2700bool
2702
2711double
2713
2722double
2724
2733double
2735
2744double
2746
2755double
2757
2766double
2768
2777double
2779
2788double
2790
2798uint64_t
2799eis_now(struct eis *eis);
2800
2804
2805#ifdef __cplusplus
2806}
2807#endif
void eis_device_configure_type(struct eis_device *device, enum eis_device_type type)
Set the device type for this device.
bool eis_device_has_capability(struct eis_device *device, enum eis_device_capability cap)
void eis_device_remove(struct eis_device *device)
Remove the device.
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.
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.
void eis_device_set_user_data(struct eis_device *eis_device, void *user_data)
struct eis_device * eis_device_unref(struct eis_device *device)
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.
void * eis_device_get_user_data(struct eis_device *eis_device)
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...
const char * eis_device_get_name(struct eis_device *device)
Return the name of the device.
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_device * eis_device_ref(struct eis_device *device)
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.
struct eis_seat * eis_device_get_seat(struct eis_device *device)
void eis_device_configure_name(struct eis_device *device, const char *name)
enum eis_device_type eis_device_get_type(struct eis_device *device)
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_device_configure_capability(struct eis_device *device, enum eis_device_capability cap)
struct eis_keymap * eis_device_keyboard_get_keymap(struct eis_device *device)
Return the keymap assigned to this device.
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...
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.
struct eis * eis_device_get_context(struct eis_device *device)
struct eis_region * eis_device_get_region(struct eis_device *device, size_t index)
Obtain a region from the 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_client * eis_device_get_client(struct eis_device *device)
struct eis_keymap * eis_keymap_unref(struct eis_keymap *keymap)
size_t eis_keymap_get_size(struct eis_keymap *keymap)
void * eis_keymap_get_user_data(struct eis_keymap *eis_keymap)
enum eis_keymap_type eis_keymap_get_type(struct eis_keymap *keymap)
Returns the type for this keymap.
struct eis_keymap * eis_keymap_ref(struct eis_keymap *keymap)
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_device * eis_keymap_get_device(struct eis_keymap *keymap)
Return the device this keymap belongs to.
void eis_keymap_set_user_data(struct eis_keymap *eis_keymap, void *user_data)
void eis_keymap_add(struct eis_keymap *keymap)
Set the keymap on the device.
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:713
eis_log_priority
Definition libeis.h:668
void eis_log_set_handler(struct eis *eis, eis_log_handler log_handler)
Change the log handler for this context.
const char * eis_log_context_get_func(struct eis_log_context *ctx)
void eis_log_set_priority(struct eis *eis, enum eis_log_priority priority)
unsigned int eis_log_context_get_line(struct eis_log_context *ctx)
enum eis_log_priority eis_log_get_priority(const struct eis *eis)
const char * eis_log_context_get_file(struct eis_log_context *ctx)
@ EIS_LOG_PRIORITY_INFO
Definition libeis.h:670
@ EIS_LOG_PRIORITY_WARNING
Definition libeis.h:671
@ EIS_LOG_PRIORITY_ERROR
Definition libeis.h:672
@ EIS_LOG_PRIORITY_DEBUG
Definition libeis.h:669
void eis_device_stylus_pressure(struct eis_device *device, double pressure)
Notify the client of the stylus pressure as a normalized value in the range [0.0, 1....
void eis_device_pinch_cancel(struct eis_device *device)
Cancel the current pinch gesture.
void eis_device_stylus_airbrush_flow(struct eis_device *device, double flow)
Notify the client of the airbrush flow control position as a normalized value in the range [0....
void eis_device_pointer_motion_absolute(struct eis_device *device, double x, double y)
see ei_device_pointer_motion_absolute
void eis_touch_set_user_data(struct eis_touch *touch, void *user_data)
see ei_touch_set_user_data
void eis_device_stylus_erase_start(struct eis_device *device)
Notify the client that the stylus eraser feature has been activated.
void * eis_touch_get_user_data(struct eis_touch *touch)
see ei_touch_get_user_data
void eis_device_pointer_motion(struct eis_device *device, double x, double y)
see ei_device_pointer_motion
void eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y)
see ei_device_scroll_stop
void eis_device_hold_cancel(struct eis_device *device)
Cancel the current hold gesture.
void eis_device_swipe_update(struct eis_device *device, double dx, double dy)
Update the current swipe gesture's position by the given relative delta.
void eis_device_pinch_update(struct eis_device *device, double dx, double dy, double scale, double rotation)
Update the current pinch gesture's position by the given relative delta, with the given absolute scal...
void eis_device_text_keysym(struct eis_device *device, uint32_t keysym, bool is_press)
see ei_device_text_keysym
struct eis_touch * eis_touch_ref(struct eis_touch *touch)
see ei_touch_ref
void eis_device_stylus_tilt(struct eis_device *device, double tilt_x, double tilt_y)
Notify the client of the stylus tilt angles in degrees, each in the range [-90.0, +90....
void eis_device_stylus_proximity_in(struct eis_device *device)
Notify the client that the stylus has entered proximity of its digitizer.
void eis_device_pinch_begin(struct eis_device *device, uint32_t nfingers)
Begin a new pinch gesture on a device with the EIS_DEVICE_CAP_GESTURES capability.
void eis_device_stylus_tip_down(struct eis_device *device)
Notify the client that the stylus has come into logical contact with its digitizer.
void eis_device_stylus_proximity_out(struct eis_device *device)
Notify the client that the stylus has left proximity of its digitizer.
void eis_device_swipe_cancel(struct eis_device *device)
Cancel the current swipe gesture.
void eis_touch_cancel(struct eis_touch *touch)
see ei_touch_cancel
void eis_device_stylus_motion(struct eis_device *device, double x, double y)
Notify the client that the stylus has moved to the given absolute position.
struct eis_touch * eis_touch_unref(struct eis_touch *touch)
see ei_touch_unref
void eis_touch_up(struct eis_touch *touch)
see ei_touch_up
void eis_device_text_utf8_with_length(struct eis_device *device, const char *text, size_t length)
see ei_device_text_utf8_with_length
void eis_device_stylus_tip_up(struct eis_device *device)
Notify the client that the stylus has left logical contact with its digitizer.
void eis_device_start_emulating(struct eis_device *device, uint32_t sequence)
see ei_device_start_emulating
void eis_device_stylus_distance(struct eis_device *device, double distance)
Notify the client of the distance between the stylus and its digitizer as a normalized value in the r...
void eis_device_text_utf8(struct eis_device *device, const char *utf8)
see ei_device_text_utf8
void eis_touch_motion(struct eis_touch *touch, double x, double y)
see ei_touch_motion
void eis_device_stylus_rotation(struct eis_device *device, double rotation)
Notify the client of the stylus barrel rotation angle in degrees, in the range [0....
void eis_device_scroll_delta(struct eis_device *device, double x, double y)
see ei_device_scroll_delta
struct eis_touch * eis_device_touch_new(struct eis_device *device)
see ei_device_touch_new
void eis_device_swipe_end(struct eis_device *device)
End the current swipe gesture.
void eis_device_swipe_begin(struct eis_device *device, uint32_t nfingers)
Begin a new swipe gesture on a device with the EIS_DEVICE_CAP_GESTURES capability.
void eis_device_configure_stylus_capability(struct eis_device *device, enum eis_stylus_capability cap)
Configure a single stylus capability offered by the server for this device.
void eis_device_pinch_end(struct eis_device *device)
End the current pinch gesture.
void eis_device_hold_end(struct eis_device *device)
End the current hold gesture.
void eis_device_stop_emulating(struct eis_device *device)
see ei_device_stop_emulating
void eis_touch_down(struct eis_touch *touch, double x, double y)
see ei_touch_down
void eis_device_keyboard_key(struct eis_device *device, uint32_t keycode, bool is_press)
see ei_device_keyboard_key
void eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y)
see ei_device_scroll_discrete
void eis_device_stylus_erase_stop(struct eis_device *device)
Notify the client that the stylus eraser feature has been deactivated.
void eis_device_button_button(struct eis_device *device, uint32_t button, bool is_press)
see ei_device_button_button
struct eis_device * eis_touch_get_device(struct eis_touch *touch)
see ei_touch_get_device
void eis_device_frame(struct eis_device *device, uint64_t time)
see ei_device_frame
void eis_device_hold_begin(struct eis_device *device, uint32_t nfingers)
Begin a new hold gesture on a device with the EIS_DEVICE_CAP_GESTURES capability.
void eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y)
see ei_device_scroll_cancel
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()
struct eis_region * eis_region_unref(struct eis_region *region)
void eis_region_add(struct eis_region *region)
Add the given region to its device.
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()
uint32_t eis_region_get_y(struct eis_region *region)
void * eis_region_get_user_data(struct eis_region *region)
uint32_t eis_region_get_height(struct eis_region *region)
bool eis_region_contains(struct eis_region *region, double x, double y)
void eis_region_set_user_data(struct eis_region *region, void *user_data)
void eis_region_set_physical_scale(struct eis_region *region, double scale)
Set the physical scale for this region.
uint32_t eis_region_get_width(struct eis_region *region)
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.
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...
uint32_t eis_region_get_x(struct eis_region *region)
double eis_region_get_physical_scale(struct eis_region *region)
struct eis_region * eis_region_ref(struct eis_region *region)
struct eis_seat * eis_seat_unref(struct eis_seat *seat)
void eis_seat_remove(struct eis_seat *seat)
Remove this seat and all its remaining devices.
struct eis_client * eis_seat_get_client(struct eis_seat *eis_seat)
void eis_seat_add(struct eis_seat *seat)
Add this seat to its client and notify the client of the seat's availability.
struct eis * eis_seat_get_context(struct eis_seat *seat)
struct eis_device * eis_seat_new_device(struct eis_seat *seat)
Create a new device on the seat.
struct eis_seat * eis_seat_ref(struct eis_seat *seat)
const char * eis_seat_get_name(struct eis_seat *eis_seat)
void * eis_seat_get_user_data(struct eis_seat *eis_seat)
bool eis_seat_has_capability(struct eis_seat *seat, enum eis_device_capability cap)
void eis_seat_configure_capability(struct eis_seat *seat, enum eis_device_capability cap)
Allow a capability on the seat.
void eis_seat_set_user_data(struct eis_seat *eis_seat, void *user_data)
bool eis_event_pinch_get_is_cancelled(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_END return true if the gesture was cancelled,...
double eis_event_stylus_get_pressure(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the normalized pressure in the range [0....
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_stylus_get_airbrush_flow(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the normalized airbrush flow in the range [0....
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,...
bool eis_event_swipe_get_is_cancelled(struct eis_event *event)
For an event of type EIS_EVENT_SWIPE_END return true if the gesture was cancelled,...
double eis_event_stylus_get_tilt_x(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the tilt along the X axis in degrees,...
double eis_event_pinch_get_rotation(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_UPDATE return the relative angle of rotation in degrees clockwis...
uint32_t eis_event_hold_get_finger_count(struct eis_event *event)
For an event of type EIS_EVENT_HOLD_BEGIN or EIS_EVENT_HOLD_END return the finger count for this gest...
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.
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 ...
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.
double eis_event_stylus_get_x(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the absolute x position.
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...
double eis_event_swipe_get_dx(struct eis_event *event)
For an event of type EIS_EVENT_SWIPE_UPDATE return the relative x movement of the logical center of t...
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,...
double eis_event_stylus_get_rotation(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the barrel rotation in degrees,...
double eis_event_stylus_get_distance(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the normalized distance in the range [0....
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...
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,...
void eis_device_pinch_abort(struct eis_device *device)
Abort the current pinch gesture, sending an aborted event to reject the sender client's gesture.
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...
double eis_event_pinch_get_dy(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_UPDATE return the relative y movement of the logical center of t...
double eis_event_swipe_get_dy(struct eis_event *event)
For an event of type EIS_EVENT_SWIPE_UPDATE return the relative y movement of the logical center of t...
uint32_t eis_event_swipe_get_finger_count(struct eis_event *event)
For an event of type EIS_EVENT_SWIPE_BEGIN, EIS_EVENT_SWIPE_UPDATE or EIS_EVENT_SWIPE_END return the ...
uint32_t eis_event_pinch_get_finger_count(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_BEGIN, EIS_EVENT_PINCH_UPDATE or EIS_EVENT_PINCH_END return the ...
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.
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,...
bool eis_event_stylus_has_capability(struct eis_event *event, enum eis_stylus_capability cap)
For an event of type EIS_EVENT_STYLUS_BIND_CAPABILITIES, return true if the given capability was boun...
void eis_device_swipe_abort(struct eis_device *device)
Abort the current swipe gesture, sending an aborted event to reject the sender client's gesture.
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...
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...
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.
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 ...
double eis_event_stylus_get_tilt_y(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the tilt along the Y axis in degrees,...
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,...
double eis_event_stylus_get_y(struct eis_event *event)
For an event of type EIS_EVENT_STYLUS_AXIS, return the absolute y position.
void eis_device_hold_abort(struct eis_device *device)
Abort the current hold gesture, sending an aborted event to reject the sender client's gesture.
double eis_event_pinch_get_scale(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_UPDATE return the normalized scale of the gesture.
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,...
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,...
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,...
double eis_event_pinch_get_dx(struct eis_event *event)
For an event of type EIS_EVENT_PINCH_UPDATE return the relative x movement of the logical center of t...
bool eis_event_hold_get_is_cancelled(struct eis_event *event)
For an event of type EIS_EVENT_HOLD_END return true if the gesture was cancelled, false otherwise.
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,...
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...
int eis_backend_fd_add_client(struct eis *ctx)
Add a new client to a context set up with eis_setup_backend_fd().
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...
struct eis_event * eis_event_unref(struct eis_event *event)
Decrease the refcount of this struct by one.
eis_device_type
The device type determines what the device represents.
Definition libeis.h:211
void eis_client_set_user_data(struct eis_client *eis_client, void *user_data)
eis_device_capability
Definition libeis.h:217
struct eis_seat * eis_event_get_seat(struct eis_event *event)
struct eis * eis_client_get_context(struct eis_client *client)
int eis_set_flag(struct eis *eis, enum eis_flag flag)
Change the behavior of the context according to the given flag.
eis_flag
Context flags to enable EIS-specific behaviors.
Definition libeis.h:629
eis_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition libeis.h:273
pid_t eis_backend_socket_get_client_pid(struct eis_client *client)
Return the pid of the client.
eis_keymap_type
Definition libeis.h:260
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_client_connect(struct eis_client *client)
Allow connection from the client.
bool eis_client_is_sender(struct eis_client *client)
Returns true if the client is a sender, false otherwise.
struct eis_seat * eis_client_new_seat(struct eis_client *client, const char *name)
Create a new logical seat with a given name.
uint64_t(* eis_clock_now_func)(struct eis *eis)
Optional override function for eis_now().
Definition libeis.h:750
struct eis_ping * eis_event_pong_get_ping(struct eis_event *event)
Returns the associated eis_ping struct with this event.
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...
enum eis_event_type eis_event_get_type(struct eis_event *event)
int eis_get_fd(struct eis *eis)
libeis keeps a single file descriptor for all events.
struct eis * eis_new(void *user_data)
Create a new libeis context with a refcount of 1.
void eis_ping_set_user_data(struct eis_ping *eis_ping, void *user_data)
Set a custom data pointer for this struct.
void eis_clock_set_now_func(struct eis *, eis_clock_now_func func)
Override the function that returns the current time eis_now().
const char * eis_client_get_name(struct eis_client *client)
Return the name set by this client.
struct eis * eis_ref(struct eis *eis)
uint64_t eis_event_get_time(struct eis_event *event)
Return the time for the event of type EIS_EVENT_FRAME in microseconds.
void * eis_client_get_user_data(struct eis_client *eis_client)
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.
struct eis_device * eis_event_get_device(struct eis_event *event)
Return the device from this event.
void eis_set_user_data(struct eis *eis, void *user_data)
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...
void eis_client_disconnect(struct eis_client *client)
Disconnect this client.
struct eis_client * eis_client_unref(struct eis_client *client)
struct eis * eis_unref(struct eis *eis)
struct eis_ping * eis_ping_unref(struct eis_ping *eis_ping)
Decrease the refcount of this struct by one.
uint64_t eis_ping_get_id(struct eis_ping *ping)
Return a unique, increasing id for this struct.
struct eis_event * eis_event_ref(struct eis_event *event)
Increase the refcount of this struct by one.
uint64_t eis_now(struct eis *eis)
int eis_setup_backend_socket(struct eis *ctx, const char *path)
Initialize the context with a UNIX socket name.
struct eis_client * eis_event_get_client(struct eis_event *event)
void * eis_ping_get_user_data(struct eis_ping *eis_ping)
Return the custom data pointer for this struct.
struct eis_client * eis_client_ref(struct eis_client *client)
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...
struct eis_ping * eis_ping_ref(struct eis_ping *eis_ping)
Increase the refcount of this struct by one.
void eis_dispatch(struct eis *eis)
Main event dispatching function.
void * eis_get_user_data(struct eis *eis)
eis_stylus_capability
Capability type for styli.
Definition libeis.h:247
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
Definition libeis.h:211
@ EIS_DEVICE_TYPE_PHYSICAL
Definition libeis.h:211
@ EIS_DEVICE_CAP_TEXT
Definition libeis.h:227
@ EIS_DEVICE_CAP_STYLUS
Definition libeis.h:235
@ EIS_DEVICE_CAP_POINTER
Definition libeis.h:218
@ EIS_DEVICE_CAP_SCROLL
Definition libeis.h:222
@ EIS_DEVICE_CAP_TOUCH
Definition libeis.h:221
@ EIS_DEVICE_CAP_GESTURES
Definition libeis.h:231
@ EIS_DEVICE_CAP_KEYBOARD
Definition libeis.h:220
@ EIS_DEVICE_CAP_BUTTON
Definition libeis.h:223
@ EIS_DEVICE_CAP_POINTER_ABSOLUTE
Definition libeis.h:219
@ EIS_FLAG_DEVICE_READY
If set, libeis will announce ei_device protocol version 3 or later.
Definition libeis.h:640
@ EIS_EVENT_TOUCH_UP
Event for a single touch released from the device's logical surface.
Definition libeis.h:426
@ EIS_EVENT_STYLUS_ERASE_START
The stylus eraser feature was activated.
Definition libeis.h:566
@ EIS_EVENT_SCROLL_STOP
An ongoing scroll sequence stopped.
Definition libeis.h:399
@ EIS_EVENT_STYLUS_ERASE_STOP
The stylus eraser feature was deactivated.
Definition libeis.h:575
@ EIS_EVENT_TEXT_KEYSYM
A key sym logical press or release event.
Definition libeis.h:438
@ EIS_EVENT_DEVICE_START_EMULATING
The client is about to send events for a device.
Definition libeis.h:369
@ EIS_EVENT_BUTTON_BUTTON
A button press or release event.
Definition libeis.h:390
@ EIS_EVENT_SWIPE_BEGIN
Event for a swipe begin.
Definition libeis.h:456
@ EIS_EVENT_PONG
Returned in response to eis_ping().
Definition libeis.h:325
@ EIS_EVENT_CLIENT_DISCONNECT
The client has disconnected, any pending requests for this client should be discarded.
Definition libeis.h:285
@ 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:312
@ EIS_EVENT_PINCH_END
Event for the logical end to the current ongoing pinch gesture.
Definition libeis.h:510
@ EIS_EVENT_SWIPE_END
Event for the logical end to the current ongoing swipe gesture.
Definition libeis.h:477
@ EIS_EVENT_DEVICE_CLOSED
The client no longer listens to events from this device.
Definition libeis.h:298
@ EIS_EVENT_TEXT_UTF8
A UTF-8 text event.
Definition libeis.h:445
@ EIS_EVENT_TOUCH_DOWN
Event for a single touch set down on the device's logical surface.
Definition libeis.h:421
@ EIS_EVENT_POINTER_MOTION
A relative motion event with delta coordinates in logical pixels or mm, depending on the device type.
Definition libeis.h:381
@ EIS_EVENT_STYLUS_BIND_CAPABILITIES
The client has bound to a set of stylus capabilities.
Definition libeis.h:539
@ EIS_EVENT_STYLUS_PROXIMITY_OUT
The stylus left proximity of its digitizer.
Definition libeis.h:557
@ EIS_EVENT_PINCH_UPDATE
Event for an update to the current ongoing pinch gesture.
Definition libeis.h:501
@ EIS_EVENT_SYNC
This event represents a synchronization request (ping) from the client implementation.
Definition libeis.h:339
@ EIS_EVENT_FRAME
"Hardware" frame event.
Definition libeis.h:351
@ EIS_EVENT_SWIPE_UPDATE
Event for an update to the current ongoing swipe gesture.
Definition libeis.h:468
@ EIS_EVENT_DEVICE_STOP_EMULATING
Stop emulating events on this device, see EIS_EVENT_DEVICE_START_EMULATING.
Definition libeis.h:373
@ EIS_EVENT_PINCH_BEGIN
Event for a pinch begin.
Definition libeis.h:488
@ EIS_EVENT_SCROLL_DELTA
A vertical and/or horizontal scroll event with logical-pixels or mm precision, depending on the devic...
Definition libeis.h:395
@ EIS_EVENT_SCROLL_CANCEL
An ongoing scroll sequence was cancelled.
Definition libeis.h:403
@ EIS_EVENT_TOUCH_MOTION
Event for a single currently-down touch changing position (or other properties).
Definition libeis.h:431
@ EIS_EVENT_CLIENT_CONNECT
A client has connected.
Definition libeis.h:280
@ EIS_EVENT_STYLUS_PROXIMITY_IN
The stylus entered proximity of its digitizer.
Definition libeis.h:548
@ EIS_EVENT_KEYBOARD_KEY
A key press or release event.
Definition libeis.h:413
@ EIS_EVENT_SCROLL_DISCRETE
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps,...
Definition libeis.h:408
@ EIS_EVENT_STYLUS_TIP_DOWN
The stylus came into logical contact with its digitizer.
Definition libeis.h:584
@ EIS_EVENT_HOLD_END
Event for the logical end to the current ongoing hold gesture.
Definition libeis.h:530
@ EIS_EVENT_STYLUS_TIP_UP
The stylus left logical contact with its digitizer.
Definition libeis.h:593
@ EIS_EVENT_SEAT_BIND
The client wants to bind or unbind a capability on this seat.
Definition libeis.h:292
@ EIS_EVENT_POINTER_MOTION_ABSOLUTE
An absolute motion event with absolute position within the device's regions or size,...
Definition libeis.h:386
@ EIS_EVENT_SEAT_DEVICE_REQUESTED
The client requested a device with the given capabilities on this seat.
Definition libeis.h:320
@ EIS_EVENT_HOLD_BEGIN
Event for a hold begin.
Definition libeis.h:521
@ EIS_EVENT_STYLUS_AXIS
The stylus moved to an absolute position.
Definition libeis.h:602
@ EIS_KEYMAP_TYPE_XKB
Definition libeis.h:261
@ EIS_STYLUS_CAP_PRESSURE
Definition libeis.h:249
@ EIS_STYLUS_CAP_ERASE
Definition libeis.h:248
@ EIS_STYLUS_CAP_TILT
Definition libeis.h:251
@ EIS_STYLUS_CAP_ROTATION
Definition libeis.h:252
@ EIS_STYLUS_CAP_AIRBRUSH_FLOW
Definition libeis.h:253
@ EIS_STYLUS_CAP_DISTANCE
Definition libeis.h:250
A callback struct returned by eis_new_ping() to handle roundtrips to the client.
Regions are only available on devices of type EIS_DEVICE_TYPE_VIRTUAL.