libei 1.6.0
A library for Emulated Input
libei.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2020 Red Hat, Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#pragma once
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <stdbool.h>
32#include <stddef.h>
33#include <stdint.h>
34
120
125
135struct ei;
136
148struct ei_device;
149
163struct ei_seat;
164
173struct ei_event;
174
182struct ei_keymap;
183
204struct ei_region;
205
216struct ei_touch;
217
226struct ei_ping;
227
251
325
348
360
887
894
898struct ei *
899ei_new(void *user_data);
900
918struct ei *
919ei_new_sender(void *user_data);
920
938struct ei *
939ei_new_receiver(void *user_data);
940
947struct ei *
948ei_ref(struct ei *ei);
949
957struct ei *
958ei_unref(struct ei *ei);
959
965void
966ei_set_user_data(struct ei *ei, void *user_data);
967
972void *
974
978bool
980
990
991struct ei_log_context;
992
997unsigned int
998ei_log_context_get_line(struct ei_log_context *ctx);
999
1004const char *
1005ei_log_context_get_file(struct ei_log_context *ctx);
1006
1011const char *
1012ei_log_context_get_func(struct ei_log_context *ctx);
1013
1031typedef void (*ei_log_handler)(struct ei *ei,
1032 enum ei_log_priority priority,
1033 const char *message,
1034 struct ei_log_context *context);
1045void
1047
1051void
1053
1057enum ei_log_priority
1059
1068typedef uint64_t (*ei_clock_now_func)(struct ei *ei);
1069
1075void
1077
1090void
1091ei_configure_name(struct ei *ei, const char *name);
1092
1114int
1115ei_setup_backend_fd(struct ei *ei, int fd);
1116
1143int
1144ei_setup_backend_socket(struct ei *ei, const char *socketpath);
1145
1152int
1153ei_get_fd(struct ei *ei);
1154
1164struct ei_ping *
1166
1179uint64_t
1181
1190struct ei_ping *
1192
1201struct ei_ping *
1203
1211void
1212ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data);
1213
1220void *
1222
1240void
1241ei_ping(struct ei_ping *ping);
1242
1252void
1254
1261struct ei_event *
1263
1280struct ei_event *
1282
1290uint64_t
1291ei_now(struct ei *ei);
1292
1308void
1310
1318void
1319ei_seat_set_user_data(struct ei_seat *seat, void *user_data);
1320
1327void *
1329
1333const char *
1335
1343bool
1345
1363void
1364ei_seat_bind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1365
1377void
1378ei_seat_unbind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1379
1404void
1405ei_seat_request_device_with_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
1406
1410struct ei_seat *
1411ei_seat_ref(struct ei_seat *seat);
1412
1416struct ei_seat *
1418
1424struct ei *
1426
1435struct ei_event *
1436ei_event_ref(struct ei_event *event);
1437
1447struct ei_event *
1449
1453enum ei_event_type
1455
1465struct ei_device *
1467
1477uint64_t
1479
1488struct ei_device *
1489ei_device_ref(struct ei_device *device);
1490
1499struct ei_device *
1501
1505struct ei_seat *
1507
1515void
1516ei_device_set_user_data(struct ei_device *device, void *user_data);
1517
1524void *
1526
1533uint32_t
1535
1542uint32_t
1544
1550size_t
1552
1559enum ei_keymap_type
1561
1569int
1571
1582struct ei_device *
1584
1593struct ei_keymap *
1594ei_keymap_ref(struct ei_keymap *keymap);
1595
1604struct ei_keymap *
1606
1610void
1611ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data);
1612
1616void *
1618
1638void
1640
1646const char *
1648
1654enum ei_device_type
1656
1664bool
1666
1688struct ei_region *
1689ei_device_get_region(struct ei_device *device, size_t index);
1690
1699struct ei_region *
1700ei_device_get_region_at(struct ei_device *device, double x, double y);
1701
1705struct ei_region *
1706ei_region_ref(struct ei_region *region);
1707
1711struct ei_region *
1713
1717void
1718ei_region_set_user_data(struct ei_region *region, void *user_data);
1719
1723void *
1725
1729uint32_t
1731
1735uint32_t
1737
1741uint32_t
1743
1747uint32_t
1749
1777const char *
1779
1786bool
1787ei_region_contains(struct ei_region *region, double x, double y);
1788
1799bool
1800ei_region_convert_point(struct ei_region *region, double *x, double *y);
1801
1871double
1873
1888/* FIXME: the current API makes it impossible to know when the keymap has
1889 * been consumed so the file stays open forever.
1890 */
1891struct ei_keymap *
1893
1899struct ei_device *
1901
1907struct ei *
1909
1939void
1940ei_device_start_emulating(struct ei_device *device, uint32_t sequence);
1941
1954void
1956
1973void
1974ei_device_frame(struct ei_device *device, uint64_t time);
1975
1988void
1989ei_device_pointer_motion(struct ei_device *device, double x, double y);
1990
2006void
2007ei_device_pointer_motion_absolute(struct ei_device *device, double x, double y);
2008
2023void
2024ei_device_button_button(struct ei_device *device, uint32_t button, bool is_press);
2025
2044void
2045ei_device_scroll_delta(struct ei_device *device, double x, double y);
2046
2069void
2070ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
2071
2101void
2102ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
2103
2132void
2133ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
2134
2155void
2156ei_device_keyboard_key(struct ei_device *device, uint32_t keycode, bool is_press);
2157
2181void
2182ei_device_text_keysym(struct ei_device *device, uint32_t keysym, bool is_press);
2183
2201void
2202ei_device_text_utf8(struct ei_device *device, const char *utf8);
2203
2223void
2224ei_device_text_utf8_with_length(struct ei_device *device, const char *text, size_t length);
2225
2238struct ei_touch *
2240
2254void
2255ei_touch_down(struct ei_touch *touch, double x, double y);
2256
2262void
2263ei_touch_motion(struct ei_touch *touch, double x, double y);
2264
2272void
2273ei_touch_up(struct ei_touch *touch);
2274
2286void
2288
2297struct ei_touch *
2298ei_touch_ref(struct ei_touch *touch);
2299
2308struct ei_touch *
2310
2318void
2319ei_touch_set_user_data(struct ei_touch *touch, void *user_data);
2320
2327void *
2329
2335struct ei_device *
2337
2351void
2352ei_device_swipe_begin(struct ei_device *device, uint32_t nfingers);
2353
2361void
2362ei_device_swipe_update(struct ei_device *device, double dx, double dy);
2363
2371void
2373
2381void
2383
2397void
2398ei_device_pinch_begin(struct ei_device *device, uint32_t nfingers);
2399
2408void
2410 double dx,
2411 double dy,
2412 double scale,
2413 double rotation);
2414
2422void
2424
2432void
2434
2448void
2449ei_device_hold_begin(struct ei_device *device, uint32_t nfingers);
2450
2458void
2460
2468void
2470
2495void
2497 enum ei_stylus_capability capability);
2498
2514void
2516
2538void
2540
2556void
2558
2575void
2577
2591void
2593
2607void
2609
2628void
2629ei_device_stylus_motion(struct ei_device *device, double x, double y);
2630
2650void
2651ei_device_stylus_pressure(struct ei_device *device, double pressure);
2652
2672void
2673ei_device_stylus_distance(struct ei_device *device, double distance);
2674
2695void
2696ei_device_stylus_tilt(struct ei_device *device, double tilt_x, double tilt_y);
2697
2717void
2718ei_device_stylus_rotation(struct ei_device *device, double rotation);
2719
2740void
2741ei_device_stylus_airbrush_flow(struct ei_device *device, double flow);
2742
2752struct ei_seat *
2754
2764struct ei_ping *
2766
2775uint32_t
2777
2785uint32_t
2787
2795uint32_t
2797
2805uint32_t
2807
2828uint32_t
2830
2837double
2839
2846double
2848
2855double
2857
2864double
2866
2873uint32_t
2875
2882bool
2884
2891double
2893
2900double
2902
2909bool
2911
2918bool
2920
2927int32_t
2929
2936int32_t
2938
2945uint32_t
2947
2954bool
2956
2969uint32_t
2971
2979double
2981
2989double
2991
3002bool
3004
3014uint32_t
3016
3026double
3028
3038double
3040
3049bool
3051
3061uint32_t
3063
3073double
3075
3085double
3087
3096double
3098
3107double
3109
3118bool
3120
3130uint32_t
3132
3141bool
3143
3152uint32_t
3154
3164bool
3166
3175const char *
3177
3198bool
3200
3209double
3211
3220double
3222
3231double
3233
3243double
3245
3254double
3256
3265double
3267
3276double
3278
3288double
3290
3294
3295#ifdef __cplusplus
3296}
3297#endif
struct ei_keymap * ei_device_keyboard_get_keymap(struct ei_device *device)
Return the keymap for this device or NULL.
uint32_t ei_device_get_width(struct ei_device *device)
Return the width of the device in mm if the device is of type EI_DEVICE_TYPE_PHYSICAL,...
void ei_device_set_user_data(struct ei_device *device, void *user_data)
Set a custom data pointer for this context.
enum ei_device_type ei_device_get_type(struct ei_device *device)
struct ei_region * ei_device_get_region_at(struct ei_device *device, double x, double y)
Return the region that contains the given point x/y (in desktop-wide coordinates) or NULL if the coor...
void ei_device_close(struct ei_device *device)
Notify the server that the client is no longer interested in this device.
struct ei_device * ei_device_unref(struct ei_device *device)
Decrease the refcount of this struct by one.
struct ei * ei_device_get_context(struct ei_device *device)
Return the struct ei context this device is associated with.
struct ei_seat * ei_device_get_seat(struct ei_device *device)
const char * ei_device_get_name(struct ei_device *device)
bool ei_device_has_capability(struct ei_device *device, enum ei_device_capability cap)
Return true if the device has the requested capability.
uint32_t ei_device_get_height(struct ei_device *device)
Return the height of the device in mm if the device is of type EI_DEVICE_TYPE_PHYSICAL,...
struct ei_device * ei_device_ref(struct ei_device *device)
Increase the refcount of this struct by one.
void * ei_device_get_user_data(struct ei_device *device)
Return the custom data pointer for this context.
struct ei_region * ei_device_get_region(struct ei_device *device, size_t index)
Obtain a region from a device of type EI_DEVICE_TYPE_VIRTUAL.
int ei_keymap_get_fd(struct ei_keymap *keymap)
Return a memmap-able file descriptor pointing to the keymap used by the device.
void * ei_keymap_get_user_data(struct ei_keymap *keymap)
size_t ei_keymap_get_size(struct ei_keymap *keymap)
enum ei_keymap_type ei_keymap_get_type(struct ei_keymap *keymap)
Returns the type for this keymap.
struct ei_keymap * ei_keymap_ref(struct ei_keymap *keymap)
Increase the refcount of this struct by one.
struct ei_keymap * ei_keymap_unref(struct ei_keymap *keymap)
Decrease the refcount of this struct by one.
void ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data)
struct ei_device * ei_keymap_get_device(struct ei_keymap *keymap)
Return the device this keymap belongs to, or NULL if it has not yet been assigned to a device.
struct ei_device * ei_keymap_get_context(struct ei_keymap *keymap)
Return the struct ei_device this keymap is associated with.
const char * ei_log_context_get_func(struct ei_log_context *ctx)
enum ei_log_priority ei_log_get_priority(const struct ei *ei)
unsigned int ei_log_context_get_line(struct ei_log_context *ctx)
const char * ei_log_context_get_file(struct ei_log_context *ctx)
ei_log_priority
Definition libei.h:984
void(* ei_log_handler)(struct ei *ei, enum ei_log_priority priority, const char *message, struct ei_log_context *context)
The log handler for library logging.
Definition libei.h:1031
void ei_log_set_priority(struct ei *ei, enum ei_log_priority priority)
void ei_log_set_handler(struct ei *ei, ei_log_handler log_handler)
Change the log handler for this context.
@ EI_LOG_PRIORITY_INFO
Definition libei.h:986
@ EI_LOG_PRIORITY_DEBUG
Definition libei.h:985
@ EI_LOG_PRIORITY_WARNING
Definition libei.h:987
@ EI_LOG_PRIORITY_ERROR
Definition libei.h:988
uint32_t ei_event_touch_get_id(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, EI_EVENT_TOUCH_MOTION, or EI_EVENT_TOUCH_UP,...
double ei_event_stylus_get_pressure(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the pressure as a normalized value in the range [0....
double ei_event_stylus_get_x(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the absolute x position in pixels (virtual) or mm (...
uint32_t ei_event_pinch_get_finger_count(struct ei_event *event)
For an event of type EI_EVENT_PINCH_BEGIN, EI_EVENT_PINCH_UPDATE or EI_EVENT_PINCH_END return the fin...
uint32_t ei_event_emulating_get_sequence(struct ei_event *event)
For an event of type EI_EVENT_DEVICE_START_EMULATING, return the sequence number set by the EIS imple...
double ei_event_scroll_get_dx(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DELTA return the x scroll distance in logical pixels or mm,...
double ei_event_pinch_get_rotation(struct ei_event *event)
For an event of type EI_EVENT_PINCH_UPDATE return the relative angle of rotation in degrees clockwise...
double ei_event_scroll_get_dy(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DELTA return the y scroll distance in logical pixels or mm,...
bool ei_event_text_get_keysym_is_press(struct ei_event *event)
For an event of type EI_EVENT_TEXT_KEYSYM return true if the event is a logical key down for the keys...
double ei_event_pinch_get_scale(struct ei_event *event)
For an event of type EI_EVENT_PINCH_UPDATE return the normalized scale of the gesture.
double ei_event_stylus_get_airbrush_flow(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the airbrush flow control position as a normalized ...
uint32_t ei_event_hold_get_finger_count(struct ei_event *event)
For an event of type EI_EVENT_HOLD_BEGIN or EI_EVENT_HOLD_END return the finger count for this gestur...
double ei_event_pointer_get_absolute_x(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION_ABSOLUTE return the x position in logical pixels or mm,...
uint32_t ei_event_swipe_get_finger_count(struct ei_event *event)
For an event of type EI_EVENT_SWIPE_BEGIN, EI_EVENT_SWIPE_UPDATE or EI_EVENT_SWIPE_END return the fin...
uint32_t ei_event_text_get_keysym(struct ei_event *event)
For an event of type EI_EVENT_TEXT_KEYSYM return the XKB-compatible keysym.
double ei_event_swipe_get_dy(struct ei_event *event)
For an event of type EI_EVENT_SWIPE_UPDATE return the relative y movement of the logical center of th...
bool ei_event_button_get_is_press(struct ei_event *event)
For an event of type EI_EVENT_BUTTON_BUTTON return true if the event is a button press,...
double ei_event_pinch_get_dy(struct ei_event *event)
For an event of type EI_EVENT_PINCH_UPDATE return the relative y movement of the logical center of th...
double ei_event_pinch_get_dx(struct ei_event *event)
For an event of type EI_EVENT_PINCH_UPDATE return the relative x movement of the logical center of th...
bool ei_event_pinch_get_is_cancelled(struct ei_event *event)
For an event of type EI_EVENT_PINCH_END return true if the gesture was cancelled, false otherwise.
bool ei_event_scroll_get_stop_y(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_STOP return whether the y axis has stopped scrolling.
bool ei_event_swipe_get_is_cancelled(struct ei_event *event)
For an event of type EI_EVENT_SWIPE_END return true if the gesture was cancelled, false otherwise.
uint32_t ei_event_keyboard_get_xkb_mods_locked(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically locked modifier...
int32_t ei_event_scroll_get_discrete_dy(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DISCRETE return the y scroll distance in fractions or multiples ...
bool ei_event_hold_get_is_cancelled(struct ei_event *event)
For an event of type EI_EVENT_HOLD_END return true if the gesture was cancelled, false otherwise.
uint32_t ei_event_keyboard_get_key(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_KEY return the key code (as defined in include/linux/input-eve...
double ei_event_touch_get_x(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, or EI_EVENT_TOUCH_MOTION, return the x coordinate of the to...
double ei_event_stylus_get_tilt_y(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the tilt along the Y axis in degrees,...
uint32_t ei_event_keyboard_get_xkb_mods_depressed(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically pressed-down mo...
double ei_event_stylus_get_tilt_x(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the tilt along the X axis in degrees,...
const char * ei_event_text_get_utf8(struct ei_event *event)
For an event of type EI_EVENT_TEXT_UTF8 return the zero-terminated UTF8 string.
double ei_event_touch_get_y(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_DOWN, or EI_EVENT_TOUCH_MOTION, return the y coordinate of the to...
double ei_event_pointer_get_dy(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION return the relative y movement in logical pixels or mm,...
double ei_event_stylus_get_rotation(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the barrel rotation in degrees in the range [0....
double ei_event_stylus_get_distance(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the distance as a normalized value in the range [0....
bool ei_event_touch_get_is_cancel(struct ei_event *event)
For an event of type EI_EVENT_TOUCH_UP return true if the event was cancelled instead of logically re...
double ei_event_stylus_get_y(struct ei_event *event)
For an event of type EI_EVENT_STYLUS_AXIS, return the absolute y position in pixels (virtual) or mm (...
bool ei_event_scroll_get_stop_x(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_CANCEL return whether the x axis has cancelled scrolling.
uint32_t ei_event_keyboard_get_xkb_mods_latched(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the mask of currently logically latched modifie...
int32_t ei_event_scroll_get_discrete_dx(struct ei_event *event)
For an event of type EI_EVENT_SCROLL_DISCRETE return the x scroll distance in fractions or multiples ...
uint32_t ei_event_button_get_button(struct ei_event *event)
For an event of type EI_EVENT_BUTTON_BUTTON return the button code as defined in linux/input-event-co...
double ei_event_pointer_get_dx(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION return the relative x movement in logical pixels or mm,...
double ei_event_swipe_get_dx(struct ei_event *event)
For an event of type EI_EVENT_SWIPE_UPDATE return the relative x movement of the logical center of th...
uint32_t ei_event_keyboard_get_xkb_group(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_MODIFIERS, get the current effective group.
double ei_event_pointer_get_absolute_y(struct ei_event *event)
For an event of type EI_EVENT_POINTER_MOTION_ABSOLUTE return the y position in logical pixels or mm,...
bool ei_event_keyboard_get_key_is_press(struct ei_event *event)
For an event of type EI_EVENT_KEYBOARD_KEY return true if the event is a key down,...
void ei_region_set_user_data(struct ei_region *region, void *user_data)
double ei_region_get_physical_scale(struct ei_region *region)
Return the physical scale for this region.
uint32_t ei_region_get_width(struct ei_region *region)
const char * ei_region_get_mapping_id(struct ei_region *region)
Get the unique identifier (representing an external resource) that is attached to this region,...
struct ei_region * ei_region_unref(struct ei_region *region)
void * ei_region_get_user_data(struct ei_region *region)
uint32_t ei_region_get_y(struct ei_region *region)
bool ei_region_contains(struct ei_region *region, double x, double y)
Return true if the point x/y (in desktop-wide coordinates) is within region.
uint32_t ei_region_get_x(struct ei_region *region)
bool ei_region_convert_point(struct ei_region *region, double *x, double *y)
Convert the point x/y in a desktop-wide coordinate system into the corresponding point relative to th...
struct ei_region * ei_region_ref(struct ei_region *region)
uint32_t ei_region_get_height(struct ei_region *region)
void ei_seat_set_user_data(struct ei_seat *seat, void *user_data)
Set a custom data pointer for this context.
struct ei * ei_seat_get_context(struct ei_seat *seat)
Return the struct ei context this seat is associated with.
void ei_seat_bind_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Bind this client to the given seat capabilities, terminated by NULL.
const char * ei_seat_get_name(struct ei_seat *seat)
void * ei_seat_get_user_data(struct ei_seat *seat)
Return the custom data pointer for this context.
struct ei_seat * ei_seat_ref(struct ei_seat *seat)
void ei_seat_request_device_with_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Request a new device with (a subset of) the given capabilities from the EIS implementation.
bool ei_seat_has_capability(struct ei_seat *seat, enum ei_device_capability cap)
Return true if the capability is available on this seat or false otherwise.
struct ei_seat * ei_seat_unref(struct ei_seat *seat)
void ei_seat_unbind_capabilities(struct ei_seat *seat,...) __attribute__((sentinel))
Unbind a seat's capabilities, terminated by NULL.
void ei_device_pinch_cancel(struct ei_device *device)
Cancel the current pinch gesture.
void ei_device_stop_emulating(struct ei_device *device)
Notify the EIS implementation that the given device is no longer sending events.
void ei_device_pinch_update(struct ei_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 ei_device_start_emulating(struct ei_device *device, uint32_t sequence)
Notify the EIS implementation that the given device is about to start sending events.
struct ei_device * ei_touch_get_device(struct ei_touch *touch)
void ei_touch_down(struct ei_touch *touch, double x, double y)
This function can only be called once on an ei_touch object.
void ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y)
Generate a scroll cancel event on a device with the EI_DEVICE_CAP_SCROLL capability.
void ei_device_stylus_proximity_in(struct ei_device *device)
Notify the server that the stylus has entered proximity of its digitizer.
void ei_device_pointer_motion_absolute(struct ei_device *device, double x, double y)
Generate an absolute motion event on a device with the EI_DEVICE_CAP_POINTER_ABSOLUTE capability.
void ei_touch_up(struct ei_touch *touch)
Release this touch.
void ei_device_scroll_delta(struct ei_device *device, double x, double y)
Generate a smooth (pixel-precise) scroll event on a device with the EI_DEVICE_CAP_SCROLL capability.
void * ei_touch_get_user_data(struct ei_touch *touch)
Return the custom data pointer for this context.
void ei_device_pinch_begin(struct ei_device *device, uint32_t nfingers)
Begin a new pinch gesture on a device with the EI_DEVICE_CAP_GESTURES capability.
void ei_device_text_keysym(struct ei_device *device, uint32_t keysym, bool is_press)
Generate a key event on a device with the EI_DEVICE_CAP_TEXT capability.
void ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y)
Generate a scroll stop event on a device with the EI_DEVICE_CAP_SCROLL capability.
void ei_device_swipe_cancel(struct ei_device *device)
Cancel the current swipe gesture.
void ei_device_button_button(struct ei_device *device, uint32_t button, bool is_press)
Generate a button event on a device with the EI_DEVICE_CAP_BUTTON capability.
void ei_device_swipe_begin(struct ei_device *device, uint32_t nfingers)
Begin a new swipe gesture on a device with the EI_DEVICE_CAP_GESTURES capability.
void ei_device_stylus_erase_start(struct ei_device *device)
Notify the server that the stylus's eraser feature has been activated.
void ei_device_swipe_update(struct ei_device *device, double dx, double dy)
Update the current swipe gesture's position by the given relative delta.
void ei_device_text_utf8_with_length(struct ei_device *device, const char *text, size_t length)
Generate a UTF-8 text event on a device with the EI_DEVICE_CAP_TEXT capability.
void ei_device_hold_cancel(struct ei_device *device)
Cancel the current hold gesture.
void ei_device_stylus_motion(struct ei_device *device, double x, double y)
Notify the server that the stylus has moved to the given absolute position.
void ei_device_stylus_pressure(struct ei_device *device, double pressure)
Notify the server of the stylus pressure as a normalized value in the range [0.0, 1....
bool ei_event_device_has_stylus_capability(struct ei_event *event, enum ei_stylus_capability capability)
Return true if the device associated with this EI_EVENT_DEVICE_ADDED event has the given stylus capab...
void ei_device_hold_end(struct ei_device *device)
End the current hold gesture.
void ei_device_text_utf8(struct ei_device *device, const char *utf8)
Generate a UTF-8 text event on a device with the EI_DEVICE_CAP_TEXT capability.
struct ei_touch * ei_touch_ref(struct ei_touch *touch)
Increase the refcount of this struct by one.
void ei_touch_motion(struct ei_touch *touch, double x, double y)
Move this touch to the new coordinates.
void ei_device_keyboard_key(struct ei_device *device, uint32_t keycode, bool is_press)
Generate a key event on a device with the EI_DEVICE_CAP_KEYBOARD capability.
void ei_device_frame(struct ei_device *device, uint64_t time)
Generate a frame event to group the current set of events into a logical hardware event.
void ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y)
Generate a discrete scroll event on a device with the EI_DEVICE_CAP_SCROLL capability.
void ei_device_swipe_end(struct ei_device *device)
End the current swipe gesture.
void ei_device_pinch_end(struct ei_device *device)
End the current pinch gesture.
struct ei_touch * ei_touch_unref(struct ei_touch *touch)
Decrease the refcount of this struct by one.
struct ei_touch * ei_device_touch_new(struct ei_device *device)
Initiate a new touch on a device with the EI_DEVICE_CAP_TOUCH capability.
void ei_touch_cancel(struct ei_touch *touch)
Cancel this touch.
void ei_device_stylus_proximity_out(struct ei_device *device)
Notify the server that the stylus has left proximity of its digitizer.
void ei_device_stylus_tilt(struct ei_device *device, double tilt_x, double tilt_y)
Notify the server of the stylus tilt angles in degrees.
void ei_device_stylus_airbrush_flow(struct ei_device *device, double flow)
Notify the server of the airbrush flow control position as a normalized value in the range [0....
void ei_device_stylus_tip_down(struct ei_device *device)
Notify the server that the stylus has come into logical contact with its digitizer.
void ei_device_stylus_distance(struct ei_device *device, double distance)
Notify the server of the distance between the stylus and its digitizer as a normalized value in the r...
void ei_device_stylus_erase_stop(struct ei_device *device)
Notify the server that the stylus's eraser feature has been deactivated.
void ei_event_device_bind_stylus_capability(struct ei_event *event, enum ei_stylus_capability capability)
Bind to the given stylus capability for the device associated with this EI_EVENT_DEVICE_ADDED event.
void ei_device_stylus_tip_up(struct ei_device *device)
Notify the server that the stylus has left logical contact with its digitizer.
void ei_device_pointer_motion(struct ei_device *device, double x, double y)
Generate a relative motion event on a device with the EI_DEVICE_CAP_POINTER capability.
void ei_touch_set_user_data(struct ei_touch *touch, void *user_data)
Set a custom data pointer for this context.
void ei_device_hold_begin(struct ei_device *device, uint32_t nfingers)
Begin a new hold gesture on a device with the EI_DEVICE_CAP_GESTURES capability.
void ei_device_stylus_rotation(struct ei_device *device, double rotation)
Notify the server of the stylus barrel rotation angle in degrees.
int ei_setup_backend_socket(struct ei *ei, const char *socketpath)
Set this ei context to use the socket backend.
bool ei_is_sender(struct ei *ei)
Returns true if the context is was created with ei_new_sender() or false otherwise.
struct ei_ping * ei_ping_ref(struct ei_ping *ei_ping)
Increase the refcount of this struct by one.
void ei_clock_set_now_func(struct ei *, ei_clock_now_func func)
Override the function that returns the current time ei_now().
struct ei * ei_new_receiver(void *user_data)
Create a new receiver ei context.
void ei_dispatch(struct ei *ei)
Main event dispatching function.
void ei_disconnect(struct ei *ei)
Disconnect the current ei context from the EIS implementation.
int ei_get_fd(struct ei *ei)
libei keeps a single file descriptor for all events.
void ei_set_user_data(struct ei *ei, void *user_data)
Set a custom data pointer for this context.
uint64_t ei_ping_get_id(struct ei_ping *ping)
Return a unique, increasing id for this struct.
struct ei_seat * ei_event_get_seat(struct ei_event *event)
Return the seat from this event.
struct ei_ping * ei_event_pong_get_ping(struct ei_event *event)
Returns the associated ei_ping struct with this event.
ei_device_type
The device type determines what the device represents.
Definition libei.h:250
struct ei_ping * ei_new_ping(struct ei *ei)
Create a new ei_ping object to trigger a round trip to the EIS implementation.
struct ei * ei_unref(struct ei *ei)
Decrease the refcount of this struct by one.
ei_stylus_capability
Stylus capabilities describe types of data that a stylus device may report.
Definition libei.h:340
struct ei * ei_new_sender(void *user_data)
Create a new sender ei context.
uint64_t ei_now(struct ei *ei)
struct ei_device * ei_event_get_device(struct ei_event *event)
Return the device from this event.
struct ei_event * ei_peek_event(struct ei *ei)
Returns the next event in the internal event queue (or NULL) without removing that event from the que...
int ei_setup_backend_fd(struct ei *ei, int fd)
Initialize the ei context on the given socket file descriptor.
ei_keymap_type
The set of supported keymap types for a struct ei_keymap.
Definition libei.h:354
uint64_t(* ei_clock_now_func)(struct ei *ei)
Optional override function for ei_now().
Definition libei.h:1068
void * ei_ping_get_user_data(struct ei_ping *ei_ping)
Return the custom data pointer for this struct.
uint64_t ei_event_get_time(struct ei_event *event)
Return the time for the event of type EI_EVENT_FRAME in microseconds.
struct ei_event * ei_event_ref(struct ei_event *event)
Increase the refcount of this struct by one.
ei_device_capability
The set of supported capabilities.
Definition libei.h:275
void ei_ping(struct ei_ping *ping)
Issue a roundtrip request to the EIS implementation, resulting in an EI_EVENT_PONG event when this ro...
struct ei_event * ei_get_event(struct ei *ei)
Return the next event from the event queue, removing it from the queue.
struct ei_event * ei_event_unref(struct ei_event *event)
Decrease the refcount of this struct by one.
enum ei_event_type ei_event_get_type(struct ei_event *event)
ei_event_type
This enum is not exhaustive, future versions of this library may add new event types.
Definition libei.h:370
void ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data)
Set a custom data pointer for this struct.
struct ei_ping * ei_ping_unref(struct ei_ping *ei_ping)
Decrease the refcount of this struct by one.
void ei_configure_name(struct ei *ei, const char *name)
Set the name for this client.
const char * ei_event_type_to_string(enum ei_event_type)
This is a debugging helper to return a string of the name of the event type, or NULL if the event typ...
struct ei * ei_ref(struct ei *ei)
Increase the refcount of this struct by one.
struct ei * ei_new(void *user_data)
This is an alias for ei_new_sender.
void * ei_get_user_data(struct ei *ei)
Return the custom data pointer for this context.
@ EI_DEVICE_TYPE_PHYSICAL
Definition libei.h:250
@ EI_DEVICE_TYPE_VIRTUAL
Definition libei.h:250
@ EI_STYLUS_CAP_ROTATION
Definition libei.h:345
@ EI_STYLUS_CAP_PRESSURE
Definition libei.h:342
@ EI_STYLUS_CAP_ERASE
Definition libei.h:341
@ EI_STYLUS_CAP_TILT
Definition libei.h:344
@ EI_STYLUS_CAP_AIRBRUSH_FLOW
Definition libei.h:346
@ EI_STYLUS_CAP_DISTANCE
Definition libei.h:343
@ EI_KEYMAP_TYPE_XKB
A libxkbcommon-compatible XKB keymap.
Definition libei.h:358
@ EI_DEVICE_CAP_POINTER
The device can send relative motion events.
Definition libei.h:279
@ EI_DEVICE_CAP_SCROLL
The device can send scroll events.
Definition libei.h:295
@ EI_DEVICE_CAP_POINTER_ABSOLUTE
The device can send absolute motion events.
Definition libei.h:283
@ EI_DEVICE_CAP_STYLUS
The device can send stylus events.
Definition libei.h:323
@ EI_DEVICE_CAP_TOUCH
The device can send touch events.
Definition libei.h:291
@ EI_DEVICE_CAP_BUTTON
The device can send button events.
Definition libei.h:299
@ EI_DEVICE_CAP_KEYBOARD
The device can send keyboard events.
Definition libei.h:287
@ EI_DEVICE_CAP_TEXT
The device can send text-like data.
Definition libei.h:305
@ EI_DEVICE_CAP_GESTURES
The device can send gesture events.
Definition libei.h:317
@ EI_EVENT_SEAT_REMOVED
The server has removed a seat previously available to this client.
Definition libei.h:416
@ EI_EVENT_SWIPE_UPDATE
Event for an update to the current ongoing swipe gesture.
Definition libei.h:694
@ EI_EVENT_POINTER_MOTION_ABSOLUTE
An absolute motion event with absolute position within the device's regions or size,...
Definition libei.h:575
@ EI_EVENT_POINTER_MOTION
A relative motion event with delta coordinates in logical pixels or mm, depending on the device type.
Definition libei.h:566
@ EI_EVENT_SCROLL_DELTA
A vertical and/or horizontal scroll event with logical-pixels or mm precision, depending on the devic...
Definition libei.h:592
@ EI_EVENT_DEVICE_START_EMULATING
The server is about to send events for a device.
Definition libei.h:549
@ EI_EVENT_SCROLL_DISCRETE
A vertical and/or horizontal scroll event with a discrete range in logical scroll steps,...
Definition libei.h:614
@ EI_EVENT_SCROLL_STOP
An ongoing scroll sequence stopped.
Definition libei.h:599
@ EI_EVENT_STYLUS_TIP_DOWN
The stylus has come into logical contact with its digitizer.
Definition libei.h:867
@ EI_EVENT_SEAT_ADDED
The server has added a seat available to this client.
Definition libei.h:404
@ EI_EVENT_STYLUS_PROXIMITY_OUT
The stylus has left proximity of its digitizer.
Definition libei.h:834
@ EI_EVENT_FRAME
"Hardware" frame event.
Definition libei.h:533
@ EI_EVENT_PINCH_END
Event for the logical end to the current ongoing pinch gesture.
Definition libei.h:761
@ EI_EVENT_STYLUS_AXIS
The stylus has moved to a new absolute position or changed any other axis value (distance,...
Definition libei.h:885
@ EI_EVENT_SWIPE_ABORTED
Event for an EIS-initiated abort of a gesture.
Definition libei.h:723
@ EI_EVENT_STYLUS_ERASE_START
The stylus's eraser feature has been activated.
Definition libei.h:845
@ EI_EVENT_PINCH_ABORTED
Event for an EIS-initiated abort of a gesture.
Definition libei.h:776
@ EI_EVENT_DEVICE_REMOVED
The server has removed a device belonging to this client.
Definition libei.h:439
@ EI_EVENT_STYLUS_PROXIMITY_IN
The stylus has entered proximity of its digitizer.
Definition libei.h:823
@ EI_EVENT_DEVICE_RESUMED
The client may send events.
Definition libei.h:463
@ EI_EVENT_SYNC
This event represents a synchronization request (ping) from the EIS implementation.
Definition libei.h:523
@ EI_EVENT_PINCH_BEGIN
Event for a pinch begin.
Definition libei.h:734
@ EI_EVENT_BUTTON_BUTTON
A button press or release event.
Definition libei.h:583
@ EI_EVENT_STYLUS_TIP_UP
The stylus has left logical contact with its digitizer.
Definition libei.h:878
@ EI_EVENT_DEVICE_ADDED
The server has added a device for this client.
Definition libei.h:427
@ EI_EVENT_HOLD_END
Event for the logical end to the current ongoing hold gesture.
Definition libei.h:801
@ EI_EVENT_TOUCH_DOWN
Event for a single touch set down on the device's logical surface.
Definition libei.h:633
@ EI_EVENT_DEVICE_PAUSED
Any events sent from this device will be discarded until the next resume.
Definition libei.h:455
@ EI_EVENT_TEXT_KEYSYM
Event for a single keysym logically pressed/released on this device.
Definition libei.h:661
@ EI_EVENT_CONNECT
The server has approved the connection to this client.
Definition libei.h:379
@ EI_EVENT_STYLUS_ERASE_STOP
The stylus's eraser feature has been deactivated.
Definition libei.h:856
@ EI_EVENT_SWIPE_BEGIN
Event for a swipe begin.
Definition libei.h:682
@ EI_EVENT_HOLD_ABORTED
Event for an EIS-initiated abort of a gesture.
Definition libei.h:816
@ EI_EVENT_PONG
Returned in response to ei_ping().
Definition libei.h:512
@ EI_EVENT_PINCH_UPDATE
Event for an update to the current ongoing pinch gesture.
Definition libei.h:747
@ EI_EVENT_DEVICE_STOP_EMULATING
The server stopped emulating events on this device, see EIS_EVENT_DEVICE_START_EMULATING.
Definition libei.h:557
@ EI_EVENT_TOUCH_UP
Event for a single touch released from the device's logical surface.
Definition libei.h:641
@ EI_EVENT_SWIPE_END
Event for the logical end to the current ongoing swipe gesture.
Definition libei.h:708
@ EI_EVENT_KEYBOARD_KEY
A key press or release event.
Definition libei.h:622
@ EI_EVENT_TOUCH_MOTION
Event for a single currently-down touch changing position (or other properties).
Definition libei.h:649
@ EI_EVENT_DISCONNECT
The server has disconnected this client - all resources left to reference this server are now obsolet...
Definition libei.h:393
@ EI_EVENT_HOLD_BEGIN
Event for a hold begin.
Definition libei.h:787
@ EI_EVENT_SCROLL_CANCEL
An ongoing scroll sequence was cancelled.
Definition libei.h:606
@ EI_EVENT_TEXT_UTF8
Event for a UTF-8 compatible text sequence sent by this device.
Definition libei.h:671
@ EI_EVENT_KEYBOARD_MODIFIERS
The server has changed the modifier state on the device's keymap.
Definition libei.h:503
A single device to generate input events from.
An event received from the EIS implementation.
A keymap for a device with the EI_DEVICE_CAP_KEYBOARD capability.
A callback struct returned by ei_new_ping() to handle roundtrips to the EIS implementation.
A rectangular region, defined by an x/y offset and a width and a height.
A logical seat for a group of devices.
A single touch initiated by a sender context.
The main context to interact with libei.