2022-03-03 09:15:57 +10:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
2020-07-14 14:41:32 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2020 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-09-29 16:53:14 +10:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
#include <stdbool.h>
|
2020-08-24 13:01:06 +10:00
|
|
|
#include <stddef.h>
|
2020-07-14 14:41:32 +10:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-10 09:03:04 +10:00
|
|
|
* @defgroup libei 🥚 EI - The client API
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
|
|
|
|
* libei is the client-side module. This API should be used by processes
|
2023-05-04 15:33:21 +10:00
|
|
|
* that need to emulate devices or capture logical events from existing devices.
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* For an example client see the [`tools/` directory in the libei
|
|
|
|
|
* repository](https://gitlab.freedesktop.org/libinput/libei/-/tree/main/tools).
|
|
|
|
|
* At its core, a libei client will
|
|
|
|
|
* - create a context with ei_new_sender() or ei_new_receiver()
|
|
|
|
|
* - set up a backend with ei_setup_backend_fd() or ei_setup_backend_socket()
|
|
|
|
|
* - register the ei_get_fd() with its own event loop
|
|
|
|
|
* - call ei_dispatch() whenever the fd triggers
|
|
|
|
|
* - call ei_get_event() and process incoming events
|
|
|
|
|
*
|
2023-05-10 09:21:36 +10:00
|
|
|
* Those events are typically a sequence of
|
|
|
|
|
* - @ref EI_EVENT_CONNECT - notification that the client was connected
|
|
|
|
|
* - @ref EI_EVENT_SEAT_ADDED - notification that a @ref ei_seat is
|
|
|
|
|
* available. The client should respond with ei_seat_bind_capabilities()
|
|
|
|
|
* - @ref EI_EVENT_DEVICE_ADDED - notification that a @ref ei_device is
|
|
|
|
|
* available in a seat.
|
|
|
|
|
* - @ref EI_EVENT_DEVICE_RESUMED - notification that the @ref ei_device is
|
|
|
|
|
* ready to emulate events. The client should respond with
|
|
|
|
|
* ei_device_start_emulating() and the required events to emulate input
|
|
|
|
|
*
|
2023-05-04 15:33:21 +10:00
|
|
|
* libei clients come in @ref ei_new_sender "sender" and @ref ei_new_receiver
|
|
|
|
|
* "receiver" modes, depending on whether the client sends or receives events
|
2023-05-05 13:34:19 +10:00
|
|
|
* from the EIS implementation. See @ref libei-sender and @ref libei-receiver
|
2024-12-11 09:23:11 +10:00
|
|
|
* for API calls specific to either mode.
|
2023-05-04 15:33:21 +10:00
|
|
|
*
|
|
|
|
|
* @note A libei context is restricted to either sender or receiver mode, not
|
2023-05-05 13:34:19 +10:00
|
|
|
* both. The EIS implementation however may accept both sender and receiver
|
2024-12-11 09:23:11 +10:00
|
|
|
* clients, and will work as corresponding receiver or sender for this
|
2023-05-04 15:33:21 +10:00
|
|
|
* client. It is up to the implementation to disconnect clients that it does not
|
|
|
|
|
* want to allow. See eis_client_is_sender() for details.
|
2022-02-25 14:41:28 +10:00
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @defgroup libei-log The logging API
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The API to control logging output.
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-receiver API for receiver clients
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The receiver client API is available only to clients created with
|
2026-03-23 12:36:22 +10:00
|
|
|
* ei_new_receiver(). For those clients the EIS implementation creates
|
2023-05-05 13:34:19 +10:00
|
|
|
* devices and sends events **to** the libei client. The primary use-case
|
|
|
|
|
* for this is input capturing, e.g. InputLeap.
|
|
|
|
|
*
|
|
|
|
|
* It is a client bug to call any of these functions for a client created
|
|
|
|
|
* with ei_new_sender().
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-sender API for sender clients
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The sender client API is available only to clients created with
|
2026-03-23 12:36:22 +10:00
|
|
|
* ei_new_sender(). For those clients the EIS implementation creates
|
|
|
|
|
* devices but it is the libei client that sends events **to** EIS
|
2024-12-11 09:23:11 +10:00
|
|
|
* implementation.
|
2023-05-05 13:34:19 +10:00
|
|
|
* The primary use-case is input emulation from a client, akin to xdotool.
|
|
|
|
|
*
|
|
|
|
|
* It is a client bug to call any of these functions for a client created
|
|
|
|
|
* with ei_new_receiver().
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-seat The seat API
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The API to query and interact with a struct @ref ei_seat
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-device The device API
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The API to query and interact with a struct @ref ei_device
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-region The region API
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The API to query a struct @ref ei_region for information
|
|
|
|
|
*
|
|
|
|
|
* @defgroup libei-keymap The keymap API
|
|
|
|
|
* @ingroup libei
|
|
|
|
|
*
|
|
|
|
|
* The API to query a struct @ref ei_keymap for information
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @addtogroup libei
|
2020-09-25 11:42:28 +10:00
|
|
|
* @{
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @struct ei
|
|
|
|
|
*
|
|
|
|
|
* The main context to interact with libei. A libei context is a single
|
|
|
|
|
* connection to an EIS implementation and may contain multiple devices, see
|
|
|
|
|
* @ref ei_device.
|
|
|
|
|
*
|
|
|
|
|
* An @ref ei context is refcounted, see ei_unref().
|
|
|
|
|
*/
|
2020-07-25 16:17:47 +10:00
|
|
|
struct ei;
|
2020-09-25 11:42:28 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @struct ei_device
|
|
|
|
|
*
|
|
|
|
|
* A single device to generate input events from. A device may have multiple
|
|
|
|
|
* capabilities. For example, a single device may be a pointer and a keyboard
|
|
|
|
|
* and a touch device. It is up to the EIS implementation on how to handle
|
|
|
|
|
* this case, some implementations may split a single device up into
|
|
|
|
|
* multiple virtual devices, others may not.
|
|
|
|
|
*
|
|
|
|
|
* An @ref ei_device is refcounted, see ei_device_unref().
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
struct ei_device;
|
2020-09-25 11:42:28 +10:00
|
|
|
|
2020-09-14 17:16:50 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_seat
|
|
|
|
|
*
|
|
|
|
|
* A logical seat for a group of devices. Seats are provided by the EIS
|
|
|
|
|
* implementation, devices may be added to a seat. The hierarchy of objects
|
|
|
|
|
* looks like this:
|
|
|
|
|
* <pre>
|
|
|
|
|
* ei ---- ei_seat one ---- ei_device 1
|
|
|
|
|
* \ \
|
|
|
|
|
* \ --- ei device 2
|
|
|
|
|
* --- ei_seat two --- ei device 3
|
|
|
|
|
* </pre>
|
|
|
|
|
*/
|
|
|
|
|
struct ei_seat;
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_event
|
|
|
|
|
*
|
2020-10-20 15:49:40 +10:00
|
|
|
* An event received from the EIS implementation. See @ref ei_event_type
|
2020-09-25 11:42:28 +10:00
|
|
|
* for the list of possible event types.
|
|
|
|
|
*
|
|
|
|
|
* An @ref ei_event is refcounted, see ei_event_unref().
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
struct ei_event;
|
|
|
|
|
|
2020-09-28 13:10:20 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_keymap
|
|
|
|
|
*
|
2026-03-23 12:36:22 +10:00
|
|
|
* A keymap for a device with the @ref EI_DEVICE_CAP_KEYBOARD capability.
|
2020-09-28 13:10:20 +10:00
|
|
|
*
|
|
|
|
|
* An @ref ei_keymap is refcounted, see ei_keymap_unref().
|
|
|
|
|
*/
|
|
|
|
|
struct ei_keymap;
|
|
|
|
|
|
2021-07-21 14:52:04 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_region
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-region
|
2021-07-21 14:52:04 +10:00
|
|
|
*
|
|
|
|
|
* A rectangular region, defined by an x/y offset and a width and a height.
|
|
|
|
|
* A region defines the area on an EIS desktop layout that is accessible by
|
|
|
|
|
* this device - this region may not be the full area of the desktop.
|
|
|
|
|
* Input events may only be sent for points within the regions.
|
|
|
|
|
*
|
|
|
|
|
* The use of regions is private to the EIS compositor and coordinates may not
|
|
|
|
|
* match the size of the actual desktop. For example, a compositor may set a
|
|
|
|
|
* 1920x1080 region to represent a 4K monitor and transparently map input
|
|
|
|
|
* events into the respective true pixels.
|
|
|
|
|
*
|
|
|
|
|
* Absolute devices may have different regions, it is up to the libei client
|
|
|
|
|
* to send events through the correct device to target the right pixel. For
|
2026-03-23 12:36:22 +10:00
|
|
|
* example, a dual-head setup may have two absolute devices, the first with a
|
2021-07-21 14:52:04 +10:00
|
|
|
* zero offset region spanning the first screen, the second with a nonzero
|
|
|
|
|
* offset spanning the second screen.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_region;
|
|
|
|
|
|
2024-11-29 14:51:02 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_touch
|
|
|
|
|
*
|
|
|
|
|
* A single touch initiated by a sender context.
|
|
|
|
|
*
|
|
|
|
|
* @see ei_device_touch_new
|
|
|
|
|
* @see ei_touch_down
|
|
|
|
|
* @see ei_touch_motion
|
|
|
|
|
* @see ei_touch_up
|
|
|
|
|
*/
|
|
|
|
|
struct ei_touch;
|
|
|
|
|
|
2024-12-04 11:17:56 +10:00
|
|
|
/**
|
|
|
|
|
* @struct ei_ping
|
|
|
|
|
*
|
|
|
|
|
* A callback struct returned by ei_new_ping() to handle
|
|
|
|
|
* roundtrips to the EIS implementation.
|
|
|
|
|
*
|
|
|
|
|
* @see ei_new_ping
|
|
|
|
|
*/
|
|
|
|
|
struct ei_ping;
|
|
|
|
|
|
2022-03-11 10:33:54 +10:00
|
|
|
/**
|
|
|
|
|
* @enum ei_device_type
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
2022-03-11 10:33:54 +10:00
|
|
|
*
|
|
|
|
|
* The device type determines what the device represents.
|
|
|
|
|
*
|
|
|
|
|
* If the device type is @ref EI_DEVICE_TYPE_VIRTUAL, the device is a
|
|
|
|
|
* virtual device representing input as applied on the EIS implementation's
|
|
|
|
|
* screen. A relative virtual device generates input events in logical pixels,
|
|
|
|
|
* an absolute virtual device generates input events in logical pixels on one
|
|
|
|
|
* of the device's regions. Virtual devices do not have a size.
|
|
|
|
|
*
|
|
|
|
|
* If the device type is @ref EI_DEVICE_TYPE_PHYSICAL, the device is a
|
|
|
|
|
* representation of a physical device as if connected to the EIS
|
|
|
|
|
* implementation's host computer. A relative physical device generates input
|
|
|
|
|
* events in mm, an absolute physical device generates input events in mm
|
|
|
|
|
* within the device's specified physical size. Physical devices do not have
|
|
|
|
|
* regions.
|
|
|
|
|
*
|
2023-02-20 13:43:04 +10:00
|
|
|
* @see ei_device_get_width
|
|
|
|
|
* @see ei_device_get_height
|
2022-03-11 10:33:54 +10:00
|
|
|
*/
|
|
|
|
|
enum ei_device_type { EI_DEVICE_TYPE_VIRTUAL = 1, EI_DEVICE_TYPE_PHYSICAL };
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
|
|
|
|
* @enum ei_device_capability
|
|
|
|
|
*
|
2022-03-04 11:52:03 +10:00
|
|
|
* The set of supported capabilities. A device may have zero or more
|
|
|
|
|
* capabilities, a device with perceived zero capabilities is typically a
|
2023-05-05 13:34:19 +10:00
|
|
|
* device with capabilities unsupported by the client - such a device should be
|
|
|
|
|
* @ref ei_device_close "closed" immediately by the client.
|
2022-03-04 11:52:03 +10:00
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* The EIS implementation decides which capabilities may exist on a seat and
|
|
|
|
|
* which capabilities exist on any individual seat. However, a device may only
|
|
|
|
|
* have capabilities the client has bound to, see
|
2023-04-27 13:44:03 +10:00
|
|
|
* ei_seat_bind_capabilities().
|
|
|
|
|
*
|
2022-03-04 11:52:03 +10:00
|
|
|
* For example, a client may bind to a seat with the pointer and keyboard
|
2023-04-27 13:44:03 +10:00
|
|
|
* capability but a given device only has the pointer capability.
|
2023-05-05 13:34:19 +10:00
|
|
|
* Keyboard events sent through that device will be treated as client bug.
|
|
|
|
|
*
|
2023-05-10 09:56:47 +10:00
|
|
|
* If a client calls ei_seat_unbind_capabilities() for a capability, the EIS
|
2023-05-05 13:34:19 +10:00
|
|
|
* implementation may remove any or all devices that have that capability.
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
2022-03-04 12:20:55 +10:00
|
|
|
* See ei_device_has_capability().
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
enum ei_device_capability {
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send relative motion events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_POINTER = (1 << 0),
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send absolute motion events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_POINTER_ABSOLUTE = (1 << 1),
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send keyboard events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_KEYBOARD = (1 << 2),
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send touch events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_TOUCH = (1 << 3),
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send scroll events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_SCROLL = (1 << 4),
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send button events
|
|
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_DEVICE_CAP_BUTTON = (1 << 5),
|
2025-08-14 16:12:35 +10:00
|
|
|
/**
|
|
|
|
|
* The device can send text-like data
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
EI_DEVICE_CAP_TEXT = (1 << 6),
|
2020-07-14 14:41:32 +10:00
|
|
|
};
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
|
|
|
|
* @enum ei_keymap_type
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* The set of supported keymap types for a struct @ref ei_keymap.
|
2020-09-25 11:42:28 +10:00
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
enum ei_keymap_type {
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
|
|
|
|
* A libxkbcommon-compatible XKB keymap.
|
|
|
|
|
*/
|
2020-09-28 13:10:20 +10:00
|
|
|
EI_KEYMAP_TYPE_XKB = 1,
|
2020-07-16 12:54:02 +10:00
|
|
|
};
|
|
|
|
|
|
2024-12-11 12:02:11 +10:00
|
|
|
/**
|
|
|
|
|
* @enum ei_event_type
|
|
|
|
|
*
|
|
|
|
|
* This enum is not exhaustive, future versions of this library may add
|
|
|
|
|
* new event types.
|
|
|
|
|
*
|
|
|
|
|
* Unknown events must be released by the caller with ei_event_unref(),
|
|
|
|
|
* see ei_get_event().
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
enum ei_event_type {
|
|
|
|
|
/**
|
2021-08-09 18:48:22 +10:00
|
|
|
* The server has approved the connection to this client. Where the
|
|
|
|
|
* server does not approve the connection, @ref EI_EVENT_DISCONNECT is
|
|
|
|
|
* sent instead.
|
2020-08-10 08:29:24 +10:00
|
|
|
*
|
|
|
|
|
* This event is only sent once after the initial connection
|
|
|
|
|
* request.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
2020-08-18 12:42:16 +10:00
|
|
|
EI_EVENT_CONNECT = 1,
|
2021-08-09 18:48:22 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
|
|
|
|
* The server has disconnected this client - all resources left to
|
|
|
|
|
* reference this server are now obsolete. Once this event has been
|
2020-09-25 11:42:28 +10:00
|
|
|
* received, the struct @ref ei and all its associated resources
|
2020-07-14 14:41:32 +10:00
|
|
|
* should be released.
|
2020-08-10 08:29:24 +10:00
|
|
|
*
|
|
|
|
|
* This event may occur at any time after the connection has been
|
2020-10-20 15:49:40 +10:00
|
|
|
* made and is the last event to be received by this ei instance.
|
2020-08-10 08:29:24 +10:00
|
|
|
*
|
|
|
|
|
* libei guarantees that a @ref EI_EVENT_DISCONNECT is provided to
|
|
|
|
|
* the caller even where the server does not send one.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
EI_EVENT_DISCONNECT,
|
|
|
|
|
|
2020-09-14 17:16:50 +10:00
|
|
|
/**
|
|
|
|
|
* The server has added a seat available to this client.
|
|
|
|
|
*
|
|
|
|
|
* libei guarantees that any seat added has a corresponding @ref
|
|
|
|
|
* EI_EVENT_SEAT_REMOVED event before @ref EI_EVENT_DISCONNECT.
|
|
|
|
|
* libei guarantees that any device in this seat generates a @ref
|
|
|
|
|
* EI_EVENT_DEVICE_REMOVED event before the @ref
|
|
|
|
|
* EI_EVENT_SEAT_REMOVED event.
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_SEAT_ADDED,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The server has removed a seat previously available to this
|
|
|
|
|
* client. The caller should release the struct @ref ei_seat and
|
2021-07-16 18:17:15 +10:00
|
|
|
* all its associated resources. No devices will be added to this seat
|
|
|
|
|
* anymore.
|
2020-09-14 17:16:50 +10:00
|
|
|
*
|
|
|
|
|
* libei guarantees that any device in this seat generates a @ref
|
|
|
|
|
* EI_EVENT_DEVICE_REMOVED event before the @ref
|
|
|
|
|
* EI_EVENT_SEAT_REMOVED event.
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_SEAT_REMOVED,
|
|
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
|
|
|
|
* The server has added a device for this client. The capabilities
|
2021-07-16 18:17:15 +10:00
|
|
|
* of the device may be a subset of the seat capabilities - it is up
|
2020-07-14 14:41:32 +10:00
|
|
|
* to the client to verify the minimum required capabilities are
|
|
|
|
|
* indeed set.
|
2020-08-10 08:29:24 +10:00
|
|
|
*
|
|
|
|
|
* libei guarantees that any device added has a corresponding @ref
|
|
|
|
|
* EI_EVENT_DEVICE_REMOVED event before @ref EI_EVENT_DISCONNECT.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
EI_EVENT_DEVICE_ADDED,
|
2020-08-10 08:29:24 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
2020-08-10 08:29:24 +10:00
|
|
|
* The server has removed a device belonging to this client. The
|
2020-09-25 11:42:28 +10:00
|
|
|
* caller should release the struct @ref ei_device and all its
|
2020-08-10 08:29:24 +10:00
|
|
|
* associated resources. Any events sent through a removed device
|
|
|
|
|
* are discarded.
|
2020-10-26 09:24:43 +10:00
|
|
|
*
|
|
|
|
|
* When this event is received, the device is already removed. A
|
2026-03-23 12:36:22 +10:00
|
|
|
* caller does not need to call ei_device_close() even on this
|
2020-10-26 09:24:43 +10:00
|
|
|
* device.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
EI_EVENT_DEVICE_REMOVED,
|
|
|
|
|
|
|
|
|
|
/**
|
2020-07-16 10:58:34 +10:00
|
|
|
* Any events sent from this device will be discarded until the next
|
2025-12-15 10:41:21 +10:00
|
|
|
* resume.
|
|
|
|
|
*
|
|
|
|
|
* Pausing a device resets the logical state of the device to neutral.
|
|
|
|
|
* This includes:
|
|
|
|
|
* - any buttons or keys logically down are released
|
|
|
|
|
* - any modifiers logically down are released
|
|
|
|
|
* - any touches logically down are released
|
|
|
|
|
*
|
|
|
|
|
* Sender clients must wait until @ref EI_EVENT_DEVICE_RESUMED
|
|
|
|
|
* before sending events.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
2021-08-23 08:25:33 +10:00
|
|
|
EI_EVENT_DEVICE_PAUSED,
|
2025-12-15 10:41:21 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
|
|
|
|
* The client may send events.
|
2025-12-15 10:41:21 +10:00
|
|
|
*
|
|
|
|
|
* Once resumed, a sender client may call ei_device_start_emulating()
|
|
|
|
|
* and begin emulating events.
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
2020-07-16 10:58:34 +10:00
|
|
|
EI_EVENT_DEVICE_RESUMED,
|
2021-08-23 09:00:29 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The server has changed the modifier state on the device's
|
|
|
|
|
* keymap. See
|
|
|
|
|
* ei_event_keyboard_get_xkb_mods_depressed(),
|
|
|
|
|
* ei_event_keyboard_get_xkb_mods_latched(),
|
|
|
|
|
* ei_event_keyboard_get_xkb_mods_locked(), and
|
|
|
|
|
* ei_event_keyboard_get_xkb_group().
|
|
|
|
|
*
|
2024-12-05 21:50:24 -08:00
|
|
|
* This event is sent in response to any modifier state or effective
|
|
|
|
|
* group change, including where the change is triggered by a client
|
|
|
|
|
* call to ei_device_keyboard_key().
|
|
|
|
|
*
|
|
|
|
|
* For receiver clients, this will always be properly ordered with
|
|
|
|
|
* EI_EVENT_KEYBOARD_KEY events, so each key event should be
|
2026-03-23 12:36:22 +10:00
|
|
|
* interpreted using the most recently received modifier
|
2024-12-05 21:50:24 -08:00
|
|
|
* state.
|
|
|
|
|
*
|
2026-03-23 12:36:22 +10:00
|
|
|
* For sender clients, this event is not inherently synchronized
|
2024-12-05 21:50:24 -08:00
|
|
|
* with calls to ei_device_keyboard_key(), but the client may call
|
|
|
|
|
* ei_ping() when synchronization is required. When the corresponding
|
|
|
|
|
* EI_EVENT_PONG event is received, all key events sent prior to the
|
|
|
|
|
* sync request are guaranteed to have been processed, and any
|
|
|
|
|
* directly-resulting modifiers events are guaranteed to have been
|
|
|
|
|
* received. Note, however, that it is still possible for
|
|
|
|
|
* indirectly-triggered state changes, such as via a keyboard
|
|
|
|
|
* shortcut not encoded in the keymap, to be reported after the done
|
|
|
|
|
* event.
|
2021-08-23 09:00:29 +10:00
|
|
|
*
|
|
|
|
|
* This event may arrive while a device is paused.
|
2024-12-05 21:50:24 -08:00
|
|
|
*
|
|
|
|
|
* Note: It was previously specified that a where a sender client
|
|
|
|
|
* triggers a modifier state change in response to
|
|
|
|
|
* ei_device_keyboard_key(), no MODIFIERS event would be sent.
|
|
|
|
|
* Clients were expected to mix calls to xkb_state_update_key() and
|
|
|
|
|
* xkb_state_update_mask() to track the state with libxkbcommon,
|
|
|
|
|
* which could lead to disagreements between the client and server as
|
|
|
|
|
* to the current state.
|
2021-08-23 09:00:29 +10:00
|
|
|
*/
|
|
|
|
|
EI_EVENT_KEYBOARD_MODIFIERS,
|
2022-02-25 14:41:28 +10:00
|
|
|
|
2024-12-04 11:17:56 +10:00
|
|
|
/**
|
|
|
|
|
* Returned in response to ei_ping().
|
|
|
|
|
*
|
|
|
|
|
* Note that in the ei protocol, the matching client request is called `sync`
|
|
|
|
|
* but for consistency in the libeis/libei API the C API uses
|
|
|
|
|
* ei_ping() with `EI_EVENT_PONG` as return.
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_PONG = 90,
|
|
|
|
|
|
2024-12-10 14:49:16 +10:00
|
|
|
/**
|
|
|
|
|
* This event represents a synchronization request (ping) from the EIS
|
|
|
|
|
* implementation. The corresponding reply (pong) will be sent when
|
|
|
|
|
* it is unref'd. It has no other API.
|
|
|
|
|
*
|
|
|
|
|
* The caller must ensure that any state changes triggered by messages
|
|
|
|
|
* received prior to this event have been resolved and communicated to the
|
|
|
|
|
* EIS implementation prior to calling ei_event_unref().
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_SYNC,
|
|
|
|
|
|
2022-02-25 14:41:28 +10:00
|
|
|
/**
|
|
|
|
|
* "Hardware" frame event. This event **must** be sent by the server
|
|
|
|
|
* and notifies the client that the previous set of events belong to
|
|
|
|
|
* the same logical hardware event.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note These events are only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_frame() for the sender context API.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
EI_EVENT_FRAME = 100,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The server is about to send events for a device. This event should
|
|
|
|
|
* be used by the client to clear the logical state of the emulated
|
|
|
|
|
* devices and/or provide UI to the user.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note These events are only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_start_emulating() for the sender context API.
|
2022-02-25 14:41:28 +10:00
|
|
|
*
|
2026-03-23 12:36:22 +10:00
|
|
|
* Note that a server may start multiple emulating sequences
|
2022-02-25 14:41:28 +10:00
|
|
|
* simultaneously, depending on the devices available.
|
|
|
|
|
* For example, in a synergy-like situation, the server
|
|
|
|
|
* may start sending pointer and keyboard once the remote device
|
|
|
|
|
* logically entered the screen.
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_DEVICE_START_EMULATING = 200,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* The server stopped emulating events on this device,
|
|
|
|
|
* see @ref EIS_EVENT_DEVICE_START_EMULATING.
|
2023-05-05 13:34:19 +10:00
|
|
|
*
|
|
|
|
|
* @note These events are only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_stop_emulating() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2022-02-25 14:41:28 +10:00
|
|
|
EI_EVENT_DEVICE_STOP_EMULATING,
|
|
|
|
|
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* A relative motion event with delta coordinates in logical pixels or
|
|
|
|
|
* mm, depending on the device type.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_pointer_motion() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2022-02-25 14:41:28 +10:00
|
|
|
EI_EVENT_POINTER_MOTION = 300,
|
2023-04-27 14:24:02 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An absolute motion event with absolute position within the device's
|
|
|
|
|
* regions or size, depending on the device type.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_pointer_motion_absolute() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_POINTER_MOTION_ABSOLUTE = 400,
|
2022-02-25 14:41:28 +10:00
|
|
|
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* A button press or release event
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_button_button() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_BUTTON_BUTTON = 500,
|
2022-02-25 14:41:28 +10:00
|
|
|
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* A vertical and/or horizontal scroll event with logical-pixels
|
|
|
|
|
* or mm precision, depending on the device type.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_scroll_delta() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_SCROLL_DELTA = 600,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* An ongoing scroll sequence stopped.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_scroll_stop() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_SCROLL_STOP,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* An ongoing scroll sequence was cancelled.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_scroll_cancel() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_SCROLL_CANCEL,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* A vertical and/or horizontal scroll event with a discrete range in
|
|
|
|
|
* logical scroll steps, like a scroll wheel.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_scroll_discrete() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_SCROLL_DISCRETE,
|
|
|
|
|
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* A key press or release event
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_keyboard_key() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_KEYBOARD_KEY = 700,
|
|
|
|
|
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* Event for a single touch set down on the device's logical surface.
|
|
|
|
|
* A touch sequence is always down/up with an optional motion event in
|
2026-03-23 12:36:22 +10:00
|
|
|
* between. On multitouch capable devices, several touch sequences
|
2023-04-27 14:24:02 +10:00
|
|
|
* may be active at any time.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_touch_new() and ei_touch_down() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2023-04-26 14:41:18 +10:00
|
|
|
EI_EVENT_TOUCH_DOWN = 800,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* Event for a single touch released from the device's logical
|
|
|
|
|
* surface.
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_touch_new() and ei_touch_up() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2022-02-25 14:41:28 +10:00
|
|
|
EI_EVENT_TOUCH_UP,
|
2023-04-27 14:24:02 +10:00
|
|
|
/**
|
|
|
|
|
* Event for a single currently-down touch changing position (or other
|
|
|
|
|
* properties).
|
|
|
|
|
*
|
2023-05-05 13:34:19 +10:00
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_touch_new() and ei_touch_motion() for the sender context API.
|
2023-04-27 14:24:02 +10:00
|
|
|
*/
|
2022-02-25 14:41:28 +10:00
|
|
|
EI_EVENT_TOUCH_MOTION,
|
2025-08-14 16:12:35 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event for a single keysym logically pressed/released on this device.
|
|
|
|
|
* The keysym is an XKB-compatible keysym (not key code!) and may not be
|
|
|
|
|
* present on any keymap currently active on any device.
|
|
|
|
|
*
|
|
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_text_keysym() for the sender context API.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_TEXT_KEYSYM = 900,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event for a UTF-8 compatible text sequence sent by this device.
|
|
|
|
|
*
|
|
|
|
|
* @note This event is only generated on a receiver ei context.
|
|
|
|
|
* See ei_device_text_utf8() for the sender context API.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
EI_EVENT_TEXT_UTF8,
|
2020-07-14 14:41:32 +10:00
|
|
|
};
|
|
|
|
|
|
2023-05-19 10:57:58 +10:00
|
|
|
/**
|
|
|
|
|
* This is a debugging helper to return a string of the name of the event type,
|
|
|
|
|
* or NULL if the event type is invalid. For example, for @ref EI_EVENT_TOUCH_UP this
|
|
|
|
|
* function returns the string "EI_EVENT_TOUCH_UP".
|
|
|
|
|
*/
|
|
|
|
|
const char *ei_event_type_to_string(enum ei_event_type);
|
|
|
|
|
|
2020-08-10 08:29:24 +10:00
|
|
|
/**
|
2022-03-28 15:56:44 +10:00
|
|
|
* This is an alias for @ref ei_new_sender.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
struct ei *
|
|
|
|
|
ei_new(void *user_data);
|
|
|
|
|
|
|
|
|
|
/**
|
2022-03-28 15:56:44 +10:00
|
|
|
* Create a new sender ei context. The context is refcounted and must be
|
2022-02-25 14:41:28 +10:00
|
|
|
* released with ei_unref().
|
|
|
|
|
*
|
2022-03-28 15:56:44 +10:00
|
|
|
* A sender ei context sends events to the EIS implementation but cannot
|
2022-03-28 15:44:21 +10:00
|
|
|
* receive events.
|
2020-08-18 12:48:14 +10:00
|
|
|
*
|
|
|
|
|
* A context supports exactly one backend, set up with one of
|
2024-08-29 11:04:18 +10:00
|
|
|
* ei_setup_backend_fd() or ei_setup_backend_socket().
|
2020-08-18 12:48:14 +10:00
|
|
|
*
|
|
|
|
|
* @param user_data An opaque pointer to be returned with ei_get_user_data()
|
|
|
|
|
*
|
|
|
|
|
* @see ei_set_user_data
|
|
|
|
|
* @see ei_get_user_data
|
|
|
|
|
* @see ei_setup_backend_fd
|
|
|
|
|
* @see ei_setup_backend_socket
|
2020-08-10 08:29:24 +10:00
|
|
|
*/
|
2020-07-25 16:17:47 +10:00
|
|
|
struct ei *
|
2022-03-28 15:56:44 +10:00
|
|
|
ei_new_sender(void *user_data);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2022-03-28 15:56:44 +10:00
|
|
|
* Create a new receiver ei context. The context is refcounted and must be
|
2022-02-25 14:41:28 +10:00
|
|
|
* released with ei_unref().
|
|
|
|
|
*
|
2022-03-28 15:56:44 +10:00
|
|
|
* A receiver ei context receives events from the EIS implementation but cannot
|
2022-03-28 15:44:21 +10:00
|
|
|
* send events.
|
2022-02-25 14:41:28 +10:00
|
|
|
*
|
|
|
|
|
* A context supports exactly one backend, set up with one of
|
2024-08-29 11:04:18 +10:00
|
|
|
* ei_setup_backend_fd() or ei_setup_backend_socket().
|
2022-02-25 14:41:28 +10:00
|
|
|
*
|
|
|
|
|
* @param user_data An opaque pointer to be returned with ei_get_user_data()
|
|
|
|
|
*
|
|
|
|
|
* @see ei_set_user_data
|
|
|
|
|
* @see ei_get_user_data
|
|
|
|
|
* @see ei_setup_backend_fd
|
|
|
|
|
* @see ei_setup_backend_socket
|
|
|
|
|
*/
|
|
|
|
|
struct ei *
|
2022-03-28 15:56:44 +10:00
|
|
|
ei_new_receiver(void *user_data);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* Increase the refcount of this struct by one. Use ei_unref() to decrease
|
|
|
|
|
* the refcount.
|
|
|
|
|
*
|
|
|
|
|
* @return the argument passed into the function
|
|
|
|
|
*/
|
|
|
|
|
struct ei *
|
|
|
|
|
ei_ref(struct ei *ei);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
|
|
|
|
* zero, the context disconnects from the server and all allocated resources
|
|
|
|
|
* are released.
|
|
|
|
|
*
|
|
|
|
|
* @return always NULL
|
|
|
|
|
*/
|
|
|
|
|
struct ei *
|
|
|
|
|
ei_unref(struct ei *ei);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set a custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_get_user_data() to retrieve a previously set
|
|
|
|
|
* user data.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_set_user_data(struct ei *ei, void *user_data);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_set_user_data() to change the user data.
|
|
|
|
|
*/
|
|
|
|
|
void *
|
|
|
|
|
ei_get_user_data(struct ei *ei);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the context is was created with ei_new_sender() or false otherwise.
|
|
|
|
|
*/
|
2022-03-28 16:21:45 +10:00
|
|
|
bool
|
2022-03-28 15:56:44 +10:00
|
|
|
ei_is_sender(struct ei *ei);
|
2022-03-28 16:21:45 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-log
|
|
|
|
|
*/
|
2020-08-20 11:51:41 +10:00
|
|
|
enum ei_log_priority {
|
|
|
|
|
EI_LOG_PRIORITY_DEBUG = 10,
|
|
|
|
|
EI_LOG_PRIORITY_INFO = 20,
|
|
|
|
|
EI_LOG_PRIORITY_WARNING = 30,
|
|
|
|
|
EI_LOG_PRIORITY_ERROR = 40,
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-03 10:09:59 +10:00
|
|
|
struct ei_log_context;
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-log
|
2022-08-03 10:09:59 +10:00
|
|
|
* @return the line number (``__LINE__``) for a given log message context.
|
|
|
|
|
*/
|
|
|
|
|
unsigned int
|
|
|
|
|
ei_log_context_get_line(struct ei_log_context *ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-log
|
2022-08-03 10:09:59 +10:00
|
|
|
* @return the file name (``__FILE__``) for a given log message context.
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
ei_log_context_get_file(struct ei_log_context *ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-log
|
2022-08-03 10:09:59 +10:00
|
|
|
* @return the function name (``__func__``) for a given log message context.
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
ei_log_context_get_func(struct ei_log_context *ctx);
|
|
|
|
|
|
2020-08-20 11:51:41 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-log
|
|
|
|
|
*
|
2020-08-20 11:51:41 +10:00
|
|
|
* The log handler for library logging. This handler is only called for
|
|
|
|
|
* messages with a log level equal or greater than than the one set in
|
|
|
|
|
* ei_log_set_priority().
|
|
|
|
|
*
|
2025-07-02 14:00:59 -07:00
|
|
|
* The context passed to this function contains auxiliary information about
|
2022-08-03 10:09:59 +10:00
|
|
|
* this log message such as the line number, file name and function name
|
2025-07-02 14:00:59 -07:00
|
|
|
* this message occurred in. The log context is valid only within the current
|
2022-08-03 10:09:59 +10:00
|
|
|
* invocation of the log handler.
|
|
|
|
|
*
|
2021-07-20 08:38:09 +10:00
|
|
|
* @param ei The EI context
|
|
|
|
|
* @param priority The log priority
|
2020-08-20 11:51:41 +10:00
|
|
|
* @param message The log message as a null-terminated string
|
2022-08-03 10:09:59 +10:00
|
|
|
* @param context A log message context for this message
|
2020-08-20 11:51:41 +10:00
|
|
|
*/
|
|
|
|
|
typedef void (*ei_log_handler)(struct ei *ei,
|
|
|
|
|
enum ei_log_priority priority,
|
2022-08-03 10:09:59 +10:00
|
|
|
const char *message,
|
|
|
|
|
struct ei_log_context *context);
|
2020-08-20 11:51:41 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-log
|
|
|
|
|
*
|
2020-08-20 11:51:41 +10:00
|
|
|
* Change the log handler for this context. If the log handler is NULL, the
|
|
|
|
|
* built-in default log function is used.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param ei The EI context
|
2020-08-20 11:51:41 +10:00
|
|
|
* @param log_handler The log handler or NULL to use the default log
|
|
|
|
|
* handler.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_log_set_handler(struct ei *ei, ei_log_handler log_handler);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-log
|
|
|
|
|
*/
|
2020-08-20 11:51:41 +10:00
|
|
|
void
|
|
|
|
|
ei_log_set_priority(struct ei *ei, enum ei_log_priority priority);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-log
|
|
|
|
|
*/
|
2020-08-20 11:51:41 +10:00
|
|
|
enum ei_log_priority
|
|
|
|
|
ei_log_get_priority(const struct ei *ei);
|
|
|
|
|
|
2023-11-08 13:59:21 +10:00
|
|
|
/**
|
|
|
|
|
* Optional override function for ei_now().
|
|
|
|
|
*
|
|
|
|
|
* By default ei_now() returns the current timestamp in CLOCK_MONOTONIC. This
|
|
|
|
|
* may be overridden by a caller to provide a different timestamp.
|
|
|
|
|
*
|
|
|
|
|
* There is rarely a need to override this function. It exists for the libei-internal test suite.
|
|
|
|
|
*/
|
|
|
|
|
typedef uint64_t (*ei_clock_now_func)(struct ei *ei);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Override the function that returns the current time ei_now().
|
|
|
|
|
*
|
|
|
|
|
* There is rarely a need to override this function. It exists for the libei-internal test suite.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_clock_set_now_func(struct ei *, ei_clock_now_func func);
|
|
|
|
|
|
2020-07-30 09:40:16 +10:00
|
|
|
/**
|
|
|
|
|
* Set the name for this client. This is a suggestion to the
|
|
|
|
|
* server only and may not be honored.
|
2020-08-10 08:29:24 +10:00
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* The client name may be used for display to the user, for example in
|
|
|
|
|
* an authorization dialog that requires the user to approve a connection to
|
|
|
|
|
* the EIS implementation.
|
|
|
|
|
*
|
2020-08-10 08:29:24 +10:00
|
|
|
* This function must be called immediately after ei_new() and before
|
2024-08-29 11:04:18 +10:00
|
|
|
* setting up a backend with ei_setup_backend_fd() or
|
|
|
|
|
* ei_setup_backend_socket().
|
2020-07-30 09:40:16 +10:00
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_configure_name(struct ei *ei, const char *name);
|
|
|
|
|
|
2020-08-05 16:09:27 +10:00
|
|
|
/**
|
2024-08-29 11:04:18 +10:00
|
|
|
* Initialize the ei context on the given socket file descriptor.
|
|
|
|
|
* The ei context will initiate the conversation with the EIS server listening
|
|
|
|
|
* on the other end of this socket.
|
2020-08-18 12:48:14 +10:00
|
|
|
*
|
2024-08-29 11:04:18 +10:00
|
|
|
* This is the preferred entry point for libei and should be the default
|
|
|
|
|
* used in new clients. It allows for private-by-default socket file descriptors
|
|
|
|
|
* and the policy on how the socket is created is delegated to the caller.
|
2020-10-20 16:11:10 +10:00
|
|
|
*
|
2020-08-18 12:48:14 +10:00
|
|
|
* If the connection was successful, an event of type @ref EI_EVENT_CONNECT
|
|
|
|
|
* or @ref EI_EVENT_DISCONNECT will become available after a future call to
|
|
|
|
|
* ei_dispatch().
|
|
|
|
|
*
|
|
|
|
|
* If the connection failed, use ei_unref() to release the data allocated
|
|
|
|
|
* for this context.
|
|
|
|
|
*
|
2024-08-29 11:04:18 +10:00
|
|
|
* This function takes ownership of the file descriptor, and will close it
|
|
|
|
|
* when tearing down.
|
|
|
|
|
*
|
2020-08-18 12:48:14 +10:00
|
|
|
* @return zero on success or a negative errno on failure
|
2020-08-05 16:09:27 +10:00
|
|
|
*/
|
2020-07-29 11:53:03 +10:00
|
|
|
int
|
2024-08-29 11:04:18 +10:00
|
|
|
ei_setup_backend_fd(struct ei *ei, int fd);
|
2020-07-29 11:53:03 +10:00
|
|
|
|
2020-08-05 16:47:26 +10:00
|
|
|
/**
|
2024-08-29 11:04:18 +10:00
|
|
|
* Set this ei context to use the socket backend. The ei context will
|
|
|
|
|
* connect to the socket at the given path and initiate the conversation
|
|
|
|
|
* with the EIS server listening on that socket.
|
|
|
|
|
*
|
|
|
|
|
* @note This backend requires the socket to be accessible
|
2026-03-23 12:36:22 +10:00
|
|
|
* to connect to and forces the EIS implementation to do identification and
|
2024-08-29 11:04:18 +10:00
|
|
|
* access control for clients. In almost all cases, the EIS implementation
|
|
|
|
|
* should use pre-created fds per client and the client should instead use
|
|
|
|
|
* ei_setup_backend_fd(). This backend is primarily useful for testing and
|
|
|
|
|
* debugging.
|
|
|
|
|
*
|
|
|
|
|
* If @a socketpath is `NULL`, the value of the environment variable
|
|
|
|
|
* `LIBEI_SOCKET` is used. If @a socketpath does not start with '/', it is
|
|
|
|
|
* relative to `$XDG_RUNTIME_DIR`. If `XDG_RUNTIME_DIR` is not set, this
|
|
|
|
|
* function fails.
|
2020-08-18 12:48:14 +10:00
|
|
|
*
|
|
|
|
|
* If the connection was successful, an event of type @ref EI_EVENT_CONNECT
|
|
|
|
|
* or @ref EI_EVENT_DISCONNECT will become available after a future call to
|
|
|
|
|
* ei_dispatch().
|
|
|
|
|
*
|
|
|
|
|
* If the connection failed, use ei_unref() to release the data allocated
|
|
|
|
|
* for this context.
|
|
|
|
|
*
|
|
|
|
|
* @return zero on success or a negative errno on failure
|
2020-08-05 16:47:26 +10:00
|
|
|
*/
|
|
|
|
|
int
|
2024-08-29 11:04:18 +10:00
|
|
|
ei_setup_backend_socket(struct ei *ei, const char *socketpath);
|
2020-08-05 16:47:26 +10:00
|
|
|
|
2020-08-04 11:09:19 +10:00
|
|
|
/**
|
2020-08-10 08:29:24 +10:00
|
|
|
* libei keeps a single file descriptor for all events. This fd should be
|
|
|
|
|
* monitored for events by the caller's mainloop, e.g. using select(). When
|
2022-11-29 09:54:48 +10:00
|
|
|
* events are available on this fd, call ei_dispatch() immediately to
|
2020-08-10 08:29:24 +10:00
|
|
|
* process.
|
2020-08-04 11:09:19 +10:00
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
int
|
2020-07-25 16:17:47 +10:00
|
|
|
ei_get_fd(struct ei *ei);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2024-12-04 11:17:56 +10:00
|
|
|
/**
|
|
|
|
|
* Create a new ei_ping object to trigger a round trip to the EIS implementation.
|
|
|
|
|
* See ei_ping() for details.
|
|
|
|
|
*
|
|
|
|
|
* The returned @ref ei_ping is refcounted, use ei_ping_unref() to
|
|
|
|
|
* drop the reference.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
struct ei_ping *
|
|
|
|
|
ei_new_ping(struct ei *ei);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return a unique, increasing id for this struct. This ID is assigned at
|
|
|
|
|
* struct creation and constant for the lifetime of the struct. The ID
|
|
|
|
|
* does not exist at the protocol level.
|
|
|
|
|
*
|
|
|
|
|
* This is a convenience API to make it easier to put this struct into
|
|
|
|
|
* e.g. a hashtable without having to use the pointer value itself.
|
|
|
|
|
*
|
|
|
|
|
* The ID increases by an unspecified amount.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
uint64_t
|
|
|
|
|
ei_ping_get_id(struct ei_ping *ping);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Increase the refcount of this struct by one. Use ei_ping_unref() to decrease
|
|
|
|
|
* the refcount.
|
|
|
|
|
*
|
|
|
|
|
* @return the argument passed into the function
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
struct ei_ping *
|
|
|
|
|
ei_ping_ref(struct ei_ping *ei_ping);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
2025-07-16 13:49:15 +10:00
|
|
|
* zero, all allocated resources for this struct are released.
|
2024-12-04 11:17:56 +10:00
|
|
|
*
|
|
|
|
|
* @return always NULL
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
struct ei_ping *
|
|
|
|
|
ei_ping_unref(struct ei_ping *ei_ping);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set a custom data pointer for this struct. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_ping_get_user_data() to retrieve a previously set
|
|
|
|
|
* user data.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_ping_set_user_data(struct ei_ping *ei_ping, void *user_data);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the custom data pointer for this struct. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_ping_set_user_data() to change the user data.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
void *
|
|
|
|
|
ei_ping_get_user_data(struct ei_ping *ei_ping);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Issue a roundtrip request to the EIS implementation, resulting in
|
|
|
|
|
* an @ref EI_EVENT_PONG event when this roundtrip has been processed. Client
|
|
|
|
|
* requests are processed in-order by the EIS implementation so this
|
|
|
|
|
* function can be used as synchronization point between requests.
|
|
|
|
|
*
|
|
|
|
|
* If the client is disconnected before the roundtrip is complete,
|
|
|
|
|
* libei will emulate a @ref EI_EVENT_PONG event before @ref
|
|
|
|
|
* EI_EVENT_DISCONNECT.
|
|
|
|
|
*
|
|
|
|
|
* Note that in the ei protocol, the client request is `ei_connection.sync`
|
|
|
|
|
* followed by `ei_callback.done`. For consistency with the
|
|
|
|
|
* libeis API the C API uses ei_ping() with and @ref EI_EVENT_PONG as return
|
|
|
|
|
* event.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_ping(struct ei_ping *ping);
|
|
|
|
|
|
2020-08-04 11:09:19 +10:00
|
|
|
/**
|
2020-10-20 15:49:40 +10:00
|
|
|
* Main event dispatching function. Reads events of the file descriptors
|
2022-11-29 09:54:48 +10:00
|
|
|
* and processes them internally. Use ei_get_event() to retrieve the
|
2020-08-04 11:09:19 +10:00
|
|
|
* events.
|
|
|
|
|
*
|
|
|
|
|
* Dispatching does not necessarily queue events. This function
|
|
|
|
|
* should be called immediately once data is available on the file
|
|
|
|
|
* descriptor returned by libei_get_fd().
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
void
|
2020-07-25 16:17:47 +10:00
|
|
|
ei_dispatch(struct ei *ei);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2020-08-04 11:09:19 +10:00
|
|
|
/**
|
|
|
|
|
* Return the next event from the event queue, removing it from the queue.
|
|
|
|
|
*
|
2024-12-11 12:02:11 +10:00
|
|
|
* The returned object must be released by the caller with ei_event_unref(),
|
|
|
|
|
* even if the event type is unknown to the caller.
|
2020-08-04 11:09:19 +10:00
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
struct ei_event *
|
2020-07-25 16:17:47 +10:00
|
|
|
ei_get_event(struct ei *ei);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2020-08-06 13:59:20 +10:00
|
|
|
/**
|
2020-09-25 11:42:28 +10:00
|
|
|
* Returns the next event in the internal event queue (or `NULL`) without
|
|
|
|
|
* removing that event from the queue; the next call to ei_get_event()
|
2020-08-06 13:59:20 +10:00
|
|
|
* will return that same event.
|
|
|
|
|
*
|
|
|
|
|
* This call is useful for checking whether there is an event and/or what
|
|
|
|
|
* type of event it is.
|
|
|
|
|
*
|
|
|
|
|
* Repeated calls to ei_peek_event() return the same event.
|
|
|
|
|
*
|
|
|
|
|
* The returned event is refcounted, use ei_event_unref() to drop the
|
|
|
|
|
* reference.
|
|
|
|
|
*
|
|
|
|
|
* A caller must not call ei_get_event() while holding a ref to an event
|
2020-09-25 11:42:28 +10:00
|
|
|
* returned by ei_peek_event(). Doing so is undefined behavior.
|
2020-08-06 13:59:20 +10:00
|
|
|
*/
|
|
|
|
|
struct ei_event *
|
|
|
|
|
ei_peek_event(struct ei *ei);
|
|
|
|
|
|
2020-08-04 11:09:19 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @returns a timestamp in microseconds for the current time to pass into
|
|
|
|
|
* ei_device_frame().
|
2020-08-04 11:09:19 +10:00
|
|
|
*
|
2023-11-08 13:59:21 +10:00
|
|
|
* By default, the returned timestamp is CLOCK_MONOTONIC for compatibility with
|
|
|
|
|
* evdev and libinput. This can be overridden with ei_clock_set_now_func().
|
2020-08-04 11:09:19 +10:00
|
|
|
*/
|
2023-05-05 13:34:19 +10:00
|
|
|
uint64_t
|
|
|
|
|
ei_now(struct ei *ei);
|
|
|
|
|
|
2024-11-28 15:38:06 +10:00
|
|
|
/**
|
|
|
|
|
* Disconnect the current ei context from the EIS implementation.
|
|
|
|
|
*
|
|
|
|
|
* After a call to ei_disconnect(), ei_get_event() will return
|
|
|
|
|
* events to remove resources (e.g. seats and devices) as if they
|
|
|
|
|
* had been removed by the EIS implementation. The last event
|
|
|
|
|
* returned by ei_get_event() is @ref EI_EVENT_DISCONNECT after
|
|
|
|
|
* which the context should be considered inert and any
|
|
|
|
|
* remaining resources released with ei_unref().
|
|
|
|
|
*
|
|
|
|
|
* This does not free the resources associated with the ei context, use
|
|
|
|
|
* ei_unref().
|
|
|
|
|
*
|
|
|
|
|
* @since 1.4
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_disconnect(struct ei *ei);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
|
|
|
|
* Set a custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_seat_get_user_data() to retrieve a
|
|
|
|
|
* previously set user data.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_seat_set_user_data(struct ei_seat *seat, void *user_data);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
|
|
|
|
* Return the custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_seat_get_user_data() to change the user data.
|
|
|
|
|
*/
|
|
|
|
|
void *
|
|
|
|
|
ei_seat_get_user_data(struct ei_seat *seat);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*/
|
2020-09-14 17:16:50 +10:00
|
|
|
const char *
|
|
|
|
|
ei_seat_get_name(struct ei_seat *seat);
|
|
|
|
|
|
2022-03-04 12:03:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
2025-07-02 14:00:59 -07:00
|
|
|
* Return true if the capability is available on this seat or false
|
2022-03-04 12:03:28 +10:00
|
|
|
* otherwise. The return value of this function is not affected by
|
|
|
|
|
* ei_seat_confirm_capability().
|
|
|
|
|
*/
|
2020-09-14 17:16:50 +10:00
|
|
|
bool
|
|
|
|
|
ei_seat_has_capability(struct ei_seat *seat, enum ei_device_capability cap);
|
|
|
|
|
|
2021-07-16 18:17:15 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
2023-05-10 09:56:47 +10:00
|
|
|
* Bind this client to the given seat capabilities, terminated by ``NULL``.
|
|
|
|
|
* Once bound, the server may
|
2022-03-28 11:33:57 +10:00
|
|
|
* create devices for the requested capability and send the respective @ref
|
2023-05-10 09:56:47 +10:00
|
|
|
* EI_EVENT_DEVICE_ADDED events. To undo, call ei_seat_unbind_capabilities().
|
2022-03-04 12:03:28 +10:00
|
|
|
*
|
2022-03-28 11:33:57 +10:00
|
|
|
* Note that binding to a capability does not guarantee a device for that
|
|
|
|
|
* capability becomes available. Devices may be added and removed at any time.
|
2022-03-04 12:03:28 +10:00
|
|
|
*
|
2022-03-28 11:33:57 +10:00
|
|
|
* It is an application bug to call this function for a capability already
|
2023-05-10 09:56:47 +10:00
|
|
|
* bound - call ei_seat_unbind_capabilities() first.
|
2021-07-16 18:17:15 +10:00
|
|
|
*
|
2022-03-28 11:33:57 +10:00
|
|
|
* Calling this function for a capability that does not exist on the seat is
|
|
|
|
|
* permitted (but obviously a noop)
|
2021-07-16 18:17:15 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2023-04-27 13:44:39 +10:00
|
|
|
ei_seat_bind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
|
2021-07-16 18:17:15 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
2025-07-02 14:00:59 -07:00
|
|
|
* Unbind a seat's capabilities, terminated by ``NULL``.
|
2026-03-23 12:36:22 +10:00
|
|
|
* This function indicates that the application is
|
2022-03-28 11:33:57 +10:00
|
|
|
* no longer interested in devices with the given capability.
|
2021-07-16 18:17:15 +10:00
|
|
|
*
|
2022-03-28 11:33:57 +10:00
|
|
|
* If any devices with the given capability are present, libei automatically
|
|
|
|
|
* calls ei_device_close() on those devices (and thus the server will send
|
|
|
|
|
* @ref EI_EVENT_DEVICE_REMOVED for those devices).
|
|
|
|
|
*/
|
|
|
|
|
void
|
2023-04-27 13:44:39 +10:00
|
|
|
ei_seat_unbind_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
|
2022-03-28 11:33:57 +10:00
|
|
|
|
2025-08-12 13:36:53 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
|
|
|
|
* Request a new device with (a subset of) the given capabilities from the EIS
|
|
|
|
|
* implementation. If the EIS implementation creates a device in response
|
|
|
|
|
* to this request the device will arrive via an event of type @ref
|
|
|
|
|
* EI_EVENT_DEVICE_ADDED.
|
|
|
|
|
*
|
|
|
|
|
* The device's capabilities may not match the requested capabilities. For
|
|
|
|
|
* example requesting a pointer + keyboard device may result in the creation
|
|
|
|
|
* of a pointer-only device or it may result in the creation of a pointer +
|
|
|
|
|
* keyboard + touch device. It is up to the caller to handle capability
|
|
|
|
|
* mismatches.
|
|
|
|
|
*
|
|
|
|
|
* This function should be used by a caller when the current set of devices
|
|
|
|
|
* is insufficient for the functionality the client requires. For example
|
|
|
|
|
* a client that has previously called ei_device_close() on a device may
|
|
|
|
|
* need a device again with similar capabilities.
|
|
|
|
|
*
|
|
|
|
|
* The capabilities must be a subset of the capabilities requested in
|
|
|
|
|
* ei_seat_bind_capabilities().
|
2025-08-14 16:12:35 +10:00
|
|
|
*
|
|
|
|
|
* @since 1.6
|
2025-08-12 13:36:53 +10:00
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_seat_request_device_with_capabilities(struct ei_seat *seat, ...) __attribute__((sentinel));
|
2021-07-16 18:17:15 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*/
|
2020-09-14 17:16:50 +10:00
|
|
|
struct ei_seat *
|
|
|
|
|
ei_seat_ref(struct ei_seat *seat);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*/
|
2020-09-14 17:16:50 +10:00
|
|
|
struct ei_seat *
|
|
|
|
|
ei_seat_unref(struct ei_seat *seat);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-seat
|
|
|
|
|
*
|
2020-09-14 17:16:50 +10:00
|
|
|
* Return the struct @ref ei context this seat is associated with.
|
|
|
|
|
*/
|
|
|
|
|
struct ei *
|
|
|
|
|
ei_seat_get_context(struct ei_seat *seat);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
2025-07-15 17:45:12 +02:00
|
|
|
* Increase the refcount of this struct by one. Use ei_event_unref() to decrease
|
|
|
|
|
* the refcount. This function always returns the same event that the reference
|
|
|
|
|
* was added to.
|
2023-05-05 13:34:19 +10:00
|
|
|
*
|
2025-07-15 17:45:12 +02:00
|
|
|
* Events should be considered transient data and not be held longer than
|
|
|
|
|
* required.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_event *
|
|
|
|
|
ei_event_ref(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
|
|
|
|
* zero, all allocated resources for this struct are released.
|
|
|
|
|
*
|
|
|
|
|
* Events should be considered transient data and not be held longer than
|
|
|
|
|
* required.
|
|
|
|
|
*
|
|
|
|
|
* @return always NULL
|
2023-05-05 13:34:19 +10:00
|
|
|
*/
|
|
|
|
|
struct ei_event *
|
|
|
|
|
ei_event_unref(struct ei_event *event);
|
|
|
|
|
|
2020-10-20 16:11:10 +10:00
|
|
|
/**
|
|
|
|
|
* @return the type of this event
|
|
|
|
|
*/
|
|
|
|
|
enum ei_event_type
|
|
|
|
|
ei_event_get_type(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the device from this event.
|
|
|
|
|
*
|
|
|
|
|
* For events of type @ref EI_EVENT_CONNECT and @ref EI_EVENT_DISCONNECT,
|
|
|
|
|
* this function returns NULL.
|
|
|
|
|
*
|
|
|
|
|
* This does not increase the refcount of the device. Use eis_device_ref()
|
|
|
|
|
* to keep a reference beyond the immediate scope.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_device *
|
|
|
|
|
ei_event_get_device(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2022-05-16 11:17:32 +10:00
|
|
|
* Return the time for the event of type @ref EI_EVENT_FRAME in microseconds.
|
|
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* @note Only events of type @ref EI_EVENT_FRAME carry a timestamp. For
|
2022-05-17 15:27:14 +10:00
|
|
|
* convenience, the timestamp for other device events is retrofitted by this
|
|
|
|
|
* library.
|
2022-05-16 11:17:32 +10:00
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* @return the event time in microseconds
|
|
|
|
|
*/
|
|
|
|
|
uint64_t
|
|
|
|
|
ei_event_get_time(struct ei_event *event);
|
|
|
|
|
|
2021-08-23 09:00:29 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Increase the refcount of this struct by one. Use ei_device_unref() to
|
|
|
|
|
* decrease the refcount.
|
|
|
|
|
*
|
|
|
|
|
* @return the argument passed into the function
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
struct ei_device *
|
|
|
|
|
ei_device_ref(struct ei_device *device);
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
2025-07-16 13:49:15 +10:00
|
|
|
* zero, all allocated resources for this struct are released.
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
|
|
|
|
* @return always NULL
|
|
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
struct ei_device *
|
|
|
|
|
ei_device_unref(struct ei_device *device);
|
|
|
|
|
|
2020-09-14 17:16:50 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
2020-09-14 17:16:50 +10:00
|
|
|
*/
|
2023-05-05 13:34:19 +10:00
|
|
|
struct ei_seat *
|
|
|
|
|
ei_device_get_seat(struct ei_device *device);
|
2020-07-16 09:17:48 +10:00
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Set a custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_device_get_user_data() to retrieve a
|
|
|
|
|
* previously set user data.
|
|
|
|
|
*/
|
2020-08-19 11:25:03 +10:00
|
|
|
void
|
|
|
|
|
ei_device_set_user_data(struct ei_device *device, void *user_data);
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Return the custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_device_get_user_data() to change the user data.
|
|
|
|
|
*/
|
2020-08-19 11:25:03 +10:00
|
|
|
void *
|
|
|
|
|
ei_device_get_user_data(struct ei_device *device);
|
|
|
|
|
|
2023-02-20 13:43:04 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2023-02-20 13:43:04 +10:00
|
|
|
* Return the width of the device in mm if the device is of type @ref
|
|
|
|
|
* EI_DEVICE_TYPE_PHYSICAL, otherwise zero.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_device_get_width(struct ei_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2023-02-20 13:43:04 +10:00
|
|
|
* Return the height of the device in mm if the device is of type @ref
|
|
|
|
|
* EI_DEVICE_TYPE_PHYSICAL, otherwise zero.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_device_get_height(struct ei_device *device);
|
|
|
|
|
|
2020-09-28 13:10:20 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* @return the size of the keymap in bytes
|
|
|
|
|
*/
|
|
|
|
|
size_t
|
|
|
|
|
ei_keymap_get_size(struct ei_keymap *keymap);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Returns the type for this keymap. The type specifies how to interpret the
|
|
|
|
|
* data at the file descriptor returned by ei_keymap_get_fd().
|
|
|
|
|
*/
|
|
|
|
|
enum ei_keymap_type
|
|
|
|
|
ei_keymap_get_type(struct ei_keymap *keymap);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Return a memmap-able file descriptor pointing to the keymap used by the
|
|
|
|
|
* device. The keymap is constant for the lifetime of the device and
|
|
|
|
|
* assigned to this device individually.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
ei_keymap_get_fd(struct ei_keymap *keymap);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Return the device this keymap belongs to, or `NULL` if it has not yet
|
|
|
|
|
* been assigned to a device.
|
|
|
|
|
*
|
|
|
|
|
* After processing and if the server changed the keymap or set the keymap
|
|
|
|
|
* to NULL, this keymap may no longer be in use by the device and future
|
|
|
|
|
* calls to this function return `NULL`.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_device *
|
|
|
|
|
ei_keymap_get_device(struct ei_keymap *keymap);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Increase the refcount of this struct by one. Use ei_keymap_unref() to
|
|
|
|
|
* decrease the refcount.
|
|
|
|
|
*
|
|
|
|
|
* @return the argument passed into the function
|
|
|
|
|
*/
|
|
|
|
|
struct ei_keymap *
|
|
|
|
|
ei_keymap_ref(struct ei_keymap *keymap);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
2025-07-16 13:49:15 +10:00
|
|
|
* zero, all allocated resources for this struct are released.
|
2020-09-28 13:10:20 +10:00
|
|
|
*
|
|
|
|
|
* @return always NULL
|
|
|
|
|
*/
|
|
|
|
|
struct ei_keymap *
|
|
|
|
|
ei_keymap_unref(struct ei_keymap *keymap);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*/
|
2021-08-12 14:21:14 +10:00
|
|
|
void
|
|
|
|
|
ei_keymap_set_user_data(struct ei_keymap *keymap, void *user_data);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*/
|
2021-08-12 14:21:14 +10:00
|
|
|
void *
|
|
|
|
|
ei_keymap_get_user_data(struct ei_keymap *keymap);
|
|
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2022-03-04 12:20:55 +10:00
|
|
|
* Notify the server that the client is no longer interested in
|
|
|
|
|
* this device.
|
2020-08-19 11:08:30 +10:00
|
|
|
*
|
2020-09-23 11:39:58 +10:00
|
|
|
* Due to the asynchronous nature of the client-server interaction,
|
|
|
|
|
* events for this device may still be in transit. The server will send an
|
|
|
|
|
* @ref EI_EVENT_DEVICE_REMOVED event for this device. After that event,
|
|
|
|
|
* device is considered removed by the server.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* A client can assume that an @ref EI_EVENT_DEVICE_REMOVED event is sent
|
2021-07-16 18:17:15 +10:00
|
|
|
* for any device for which ei_device_close() was called before the @ref
|
2022-03-04 12:20:55 +10:00
|
|
|
* EI_EVENT_DISCONNECT event. Where a client gets
|
2020-09-25 11:42:28 +10:00
|
|
|
* disconnected libei will emulate that event.
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* This does not release any resources associated with this device, use
|
|
|
|
|
* ei_device_unref() for any references held by the client.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2021-07-16 18:17:15 +10:00
|
|
|
ei_device_close(struct ei_device *device);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* @return the name of the device (if any) or NULL
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
ei_device_get_name(struct ei_device *device);
|
|
|
|
|
|
2022-03-11 10:33:54 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2023-04-27 13:44:03 +10:00
|
|
|
* @return the device type
|
2022-03-11 10:33:54 +10:00
|
|
|
*/
|
|
|
|
|
enum ei_device_type
|
|
|
|
|
ei_device_get_type(struct ei_device *device);
|
|
|
|
|
|
2020-08-10 08:29:24 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-08-10 08:29:24 +10:00
|
|
|
* Return true if the device has the requested capability. Device
|
2023-04-27 14:24:02 +10:00
|
|
|
* capabilities are constant for the lifetime of the device and always
|
|
|
|
|
* a subset of the capabilities bound to by ei_seat_bind_capabilities().
|
2020-08-10 08:29:24 +10:00
|
|
|
*/
|
2020-07-14 14:41:32 +10:00
|
|
|
bool
|
|
|
|
|
ei_device_has_capability(struct ei_device *device, enum ei_device_capability cap);
|
2021-07-21 14:52:04 +10:00
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2022-03-11 10:33:54 +10:00
|
|
|
* Obtain a region from a device of type @ref EI_DEVICE_TYPE_VIRTUAL. The
|
|
|
|
|
* number of regions is constant for a device and the indices of any region
|
|
|
|
|
* remains the same for the lifetime of the device.
|
2021-07-21 14:52:04 +10:00
|
|
|
*
|
|
|
|
|
* Regions are shared between all capabilities. Where two capabilities need
|
2022-03-04 12:20:55 +10:00
|
|
|
* different regions, the EIS implementation must create multiple devices with
|
|
|
|
|
* individual capabilities and regions. For example, two touchscreens that are
|
|
|
|
|
* mapped to two screens would typically show up as two separate devices with
|
|
|
|
|
* one region each.
|
2021-07-21 14:52:04 +10:00
|
|
|
*
|
|
|
|
|
* This function returns the given region or NULL if the index is larger than
|
|
|
|
|
* the number of regions available.
|
|
|
|
|
*
|
|
|
|
|
* This does not increase the refcount of the region. Use ei_region_ref() to
|
|
|
|
|
* keep a reference beyond the immediate scope.
|
2022-03-11 10:33:54 +10:00
|
|
|
*
|
|
|
|
|
* Devices of type @ref EI_DEVICE_TYPE_PHYSICAL do not have regions.
|
2020-09-25 11:42:28 +10:00
|
|
|
*/
|
2021-07-21 14:52:04 +10:00
|
|
|
struct ei_region *
|
|
|
|
|
ei_device_get_region(struct ei_device *device, size_t index);
|
|
|
|
|
|
2023-08-29 11:37:16 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
|
|
|
|
* Return the region that contains the given point x/y (in desktop-wide
|
|
|
|
|
* coordinates) or NULL if the coordinates are outside all regions.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.1
|
|
|
|
|
*/
|
|
|
|
|
struct ei_region *
|
|
|
|
|
ei_device_get_region_at(struct ei_device *device, double x, double y);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2021-07-21 14:52:04 +10:00
|
|
|
struct ei_region *
|
|
|
|
|
ei_region_ref(struct ei_region *region);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2021-07-21 14:52:04 +10:00
|
|
|
struct ei_region *
|
|
|
|
|
ei_region_unref(struct ei_region *region);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2021-07-21 14:52:04 +10:00
|
|
|
void
|
|
|
|
|
ei_region_set_user_data(struct ei_region *region, void *user_data);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2021-07-21 14:52:04 +10:00
|
|
|
void *
|
|
|
|
|
ei_region_get_user_data(struct ei_region *region);
|
|
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2020-07-16 12:54:02 +10:00
|
|
|
uint32_t
|
2021-07-21 14:52:04 +10:00
|
|
|
ei_region_get_x(struct ei_region *region);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2020-07-16 12:54:02 +10:00
|
|
|
uint32_t
|
2021-07-21 14:52:04 +10:00
|
|
|
ei_region_get_y(struct ei_region *region);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2020-07-16 12:54:02 +10:00
|
|
|
uint32_t
|
2021-07-21 14:52:04 +10:00
|
|
|
ei_region_get_width(struct ei_region *region);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2023-05-05 13:34:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*/
|
2020-07-16 12:54:02 +10:00
|
|
|
uint32_t
|
2021-07-21 14:52:04 +10:00
|
|
|
ei_region_get_height(struct ei_region *region);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2023-08-28 21:24:33 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-region
|
|
|
|
|
*
|
|
|
|
|
* Get the unique identifier (representing an external resource) that is
|
|
|
|
|
* attached to this region, if any. This is only available if the EIS
|
|
|
|
|
* implementation supports version 2 or later of the ei_device protocol
|
2025-07-02 14:00:59 -07:00
|
|
|
* interface *and* the EIS implementation chooses to attach such an identifier to
|
2023-08-28 21:24:33 +10:00
|
|
|
* the region.
|
|
|
|
|
*
|
|
|
|
|
* This ID can be used by the client to identify an external resource that has a
|
|
|
|
|
* relationship with this region.
|
|
|
|
|
*
|
|
|
|
|
* For example the client may receive a data stream with the video
|
|
|
|
|
* data that this region represents. By attaching the same identifier to the data
|
|
|
|
|
* stream and this region the EIS implementation can inform the client
|
|
|
|
|
* that the video data stream and the region represent paired data.
|
|
|
|
|
* Note that in this example use-case, if the stream is resized
|
|
|
|
|
* there may be a transition period where two regions have the same identifier -
|
|
|
|
|
* the old region and the new region with the updated size. A client must be
|
2026-03-23 12:36:22 +10:00
|
|
|
* able to handle the case where two mapping ids are identical.
|
2023-08-28 21:24:33 +10:00
|
|
|
*
|
|
|
|
|
* libei does not look at or modify the value of the mapping id. Because the ID is
|
|
|
|
|
* assigned by the caller libei makes no guarantee that the ID is unique
|
|
|
|
|
* and/or corresponds to any particular format.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.1
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
ei_region_get_mapping_id(struct ei_region *region);
|
|
|
|
|
|
2021-07-26 15:45:08 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-region
|
|
|
|
|
*
|
2021-07-26 15:45:08 +10:00
|
|
|
* Return true if the point x/y (in desktop-wide coordinates) is within @a
|
|
|
|
|
* region.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
ei_region_contains(struct ei_region *region, double x, double y);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-region
|
|
|
|
|
*
|
2021-07-26 15:45:08 +10:00
|
|
|
* Convert the point x/y in a desktop-wide coordinate system into the
|
|
|
|
|
* corresponding point relative to the offset of the given region.
|
|
|
|
|
* If the point is inside the region, this function returns true and @a x and @a
|
2022-03-04 12:20:55 +10:00
|
|
|
* y are set to the points with the region offset subtracted.
|
2021-07-26 15:45:08 +10:00
|
|
|
* If the point is outside the region, this function returns false and @a x
|
|
|
|
|
* and @a y are left unmodified.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
ei_region_convert_point(struct ei_region *region, double *x, double *y);
|
|
|
|
|
|
2021-07-23 10:30:35 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-region
|
|
|
|
|
*
|
2021-07-23 10:30:35 +10:00
|
|
|
* Return the physical scale for this region. The default scale is 1.0.
|
|
|
|
|
*
|
|
|
|
|
* The regions' coordinate space is in logical pixels in the EIS range. The
|
|
|
|
|
* logical pixels may or may not match the physical pixels on the output
|
|
|
|
|
* range but the mapping from logical pixels to physical pixels is performed
|
|
|
|
|
* by the EIS implementation.
|
|
|
|
|
*
|
|
|
|
|
* In some use-cases though, relative data from a remote input source needs
|
|
|
|
|
* to be converted by the libei client into an absolute movement on an EIS
|
|
|
|
|
* region. In that case, the physical scale provides the factor to multiply
|
|
|
|
|
* the relative logical input to provide the expected physical relative
|
|
|
|
|
* movement.
|
|
|
|
|
*
|
|
|
|
|
* For example consider the following dual-monitor setup comprising a 2k and
|
|
|
|
|
* a 4k monitor **of the same physical size**:
|
|
|
|
|
* The physical layout of the monitors appears like this:
|
|
|
|
|
* @code
|
|
|
|
|
* 2k 4k
|
|
|
|
|
* +-------------++-------------+
|
|
|
|
|
* | || |
|
|
|
|
|
* | a b || c d |
|
|
|
|
|
* | || |
|
|
|
|
|
* +-------------++-------------+
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* The physical distance `ab` is the same as the physical distance `cd`.
|
|
|
|
|
* Where the EIS implementation supports high-dpi screens, the logical
|
|
|
|
|
* distance (in pixels) are identical too.
|
|
|
|
|
*
|
|
|
|
|
* Where the EIS implementation does not support high-dpi screens, the
|
|
|
|
|
* logical layout of these two monitors appears like this:
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* 2k 4k
|
|
|
|
|
* +-------------++--------------------------+
|
|
|
|
|
* | || |
|
|
|
|
|
* | a b || |
|
|
|
|
|
* | || |
|
|
|
|
|
* +-------------+| c d |
|
|
|
|
|
* | |
|
|
|
|
|
* | |
|
|
|
|
|
* | |
|
|
|
|
|
* +--------------------------+
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* While the two physical distances `ab` and `cd` are still identical, the
|
|
|
|
|
* logical distance `cd` (in pixels) is twice that of `ab`.
|
|
|
|
|
* Where a libei client receives relative deltas from an input source and
|
|
|
|
|
* converts that relative input into an absolute position on the screen, it
|
|
|
|
|
* needs to take this into account.
|
|
|
|
|
*
|
|
|
|
|
* For example, if a remote input source moves by relative 100 logical
|
|
|
|
|
* pixels, the libei client would convert this as `a + 100 = b` on the
|
|
|
|
|
* region for the 2k screen and send the absolute events to logically change
|
|
|
|
|
* the position from `a` to `b`. If the same remote input source moves by
|
|
|
|
|
* relative 100 logical pixels, the libei client would convert this as
|
|
|
|
|
* `c + 100 * scale = d` on the region for the 4k screen to logically
|
|
|
|
|
* change the position from `c` to `d`. While the pixel movement differs,
|
|
|
|
|
* the physical movement as seen by the user is thus identical.
|
|
|
|
|
*
|
|
|
|
|
* A second possible use-case for the physical scale is to match pixels from
|
|
|
|
|
* one region to their respective counterpart on a different region.
|
|
|
|
|
* For example, if the bottom-right corner of the 2k screen in the
|
2022-03-04 12:20:55 +10:00
|
|
|
* illustration above has a coordinate of ``(x, y)``, the neighbouring pixel on
|
|
|
|
|
* the **physical** 4k screen is ``(0, y * scale)``.
|
2021-07-23 10:30:35 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_region_get_physical_scale(struct ei_region *region);
|
|
|
|
|
|
2020-07-16 12:54:02 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Return the keymap for this device or `NULL`. The keymap is constant for
|
2022-03-04 12:20:55 +10:00
|
|
|
* the lifetime of the device and applies to this device individually.
|
2020-07-16 12:54:02 +10:00
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* If this function returns `NULL`, this device does not have
|
|
|
|
|
* an individual keymap assigned. What keymap applies to the device in this
|
|
|
|
|
* case is a server implementation detail.
|
|
|
|
|
*
|
|
|
|
|
* This does not increase the refcount of the keymap. Use ei_keymap_ref() to
|
|
|
|
|
* keep a reference beyond the immediate scope.
|
2020-07-16 12:54:02 +10:00
|
|
|
*
|
2022-03-04 12:20:55 +10:00
|
|
|
*/
|
|
|
|
|
/* FIXME: the current API makes it impossible to know when the keymap has
|
2020-07-16 12:54:02 +10:00
|
|
|
* been consumed so the file stays open forever.
|
|
|
|
|
*/
|
2020-09-28 13:10:20 +10:00
|
|
|
struct ei_keymap *
|
2020-08-28 13:58:56 +10:00
|
|
|
ei_device_keyboard_get_keymap(struct ei_device *device);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-keymap
|
|
|
|
|
*
|
2020-09-28 13:10:20 +10:00
|
|
|
* Return the struct @ref ei_device this keymap is associated with.
|
2020-07-16 12:54:02 +10:00
|
|
|
*/
|
2020-09-28 13:10:20 +10:00
|
|
|
struct ei_device *
|
|
|
|
|
ei_keymap_get_context(struct ei_keymap *keymap);
|
2020-07-16 12:54:02 +10:00
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-device
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Return the struct @ref ei context this device is associated with.
|
|
|
|
|
*/
|
2020-07-25 16:17:47 +10:00
|
|
|
struct ei *
|
2020-07-14 14:41:32 +10:00
|
|
|
ei_device_get_context(struct ei_device *device);
|
|
|
|
|
|
2022-03-02 15:54:15 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2022-03-02 15:54:15 +10:00
|
|
|
* Notify the EIS implementation that the given device is about to start
|
|
|
|
|
* sending events. This should be seen more as a transactional boundary than a
|
2023-01-30 10:31:07 +10:00
|
|
|
* time-based boundary. The primary use-cases for this are to allow for setup on
|
2022-03-02 15:54:15 +10:00
|
|
|
* the EIS implementation side and/or UI updates to indicate that a device is
|
2023-01-30 10:31:07 +10:00
|
|
|
* sending events now and for out-of-band information to sync with a given event
|
|
|
|
|
* sequence.
|
2022-03-02 15:54:15 +10:00
|
|
|
*
|
|
|
|
|
* There is no actual requirement that events start immediately once emulation
|
|
|
|
|
* starts and there is no requirement that a client calls
|
|
|
|
|
* ei_device_stop_emulating() after the most recent events.
|
|
|
|
|
*
|
|
|
|
|
* For example, in a synergy-like use-case the client would call
|
2026-03-23 12:36:22 +10:00
|
|
|
* ei_device_start_emulating() once the pointer moves into the screen and
|
2022-03-02 15:54:15 +10:00
|
|
|
* ei_device_stop_emulating() once the pointer moves out of the screen.
|
|
|
|
|
*
|
|
|
|
|
* Sending events before ei_device_start_emulating() or after
|
|
|
|
|
* ei_device_stop_emulating() is a client bug.
|
2023-01-30 10:31:07 +10:00
|
|
|
*
|
|
|
|
|
* The sequence number identifies this transaction between start/stop emulating.
|
|
|
|
|
* It must go up by at least 1 on each call to
|
|
|
|
|
* ei_device_start_emulating(). Wraparound must be handled by the EIS
|
|
|
|
|
* implementation but Callers must ensure that detection of wraparound is
|
2026-03-23 12:36:22 +10:00
|
|
|
* reasonable.
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
2022-03-02 15:54:15 +10:00
|
|
|
*/
|
2021-08-24 09:53:10 +10:00
|
|
|
void
|
2023-01-30 10:31:07 +10:00
|
|
|
ei_device_start_emulating(struct ei_device *device, uint32_t sequence);
|
2021-08-24 09:53:10 +10:00
|
|
|
|
2022-03-02 15:54:15 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2022-03-02 15:54:15 +10:00
|
|
|
* Notify the EIS implementation that the given device is no longer sending
|
|
|
|
|
* events. See ei_device_start_emulating() for details.
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
2024-12-06 10:56:07 +10:00
|
|
|
* If the device is not logically in a neutral state, that state is left
|
|
|
|
|
* as-is. It is the caller's responsibility to release any buttons, keys, touch
|
|
|
|
|
* sequences, etc. when stopping emulation to avoid adverse side effects.
|
|
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
2022-03-02 15:54:15 +10:00
|
|
|
*/
|
2021-08-24 09:53:10 +10:00
|
|
|
void
|
|
|
|
|
ei_device_stop_emulating(struct ei_device *device);
|
|
|
|
|
|
2021-08-23 10:50:23 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2021-08-23 10:50:23 +10:00
|
|
|
* Generate a frame event to group the current set of events
|
|
|
|
|
* into a logical hardware event. This function **must** be called after any
|
|
|
|
|
* other event has been generated.
|
2022-05-16 11:17:32 +10:00
|
|
|
*
|
|
|
|
|
* The given timestamp applies to all events in the current frame.
|
|
|
|
|
* The timestamp must be in microseconds of CLOCK_MONOTONIC, use the return
|
|
|
|
|
* value of ei_now() to get a compatible timestamp.
|
|
|
|
|
*
|
|
|
|
|
* @note libei does not prevent a caller from passing in a future time but it
|
|
|
|
|
* is strongly recommended that this is avoided by the caller.
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
2021-08-23 10:50:23 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2022-05-16 11:17:32 +10:00
|
|
|
ei_device_frame(struct ei_device *device, uint64_t time);
|
2021-08-23 10:50:23 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* Generate a relative motion event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_POINTER capability.
|
|
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2023-06-06 10:53:16 +10:00
|
|
|
* @param x The x movement in logical pixels or mm, depending on the device type
|
|
|
|
|
* @param y The y movement in logical pixels or mm, depending on the device type
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2020-08-13 15:03:27 +10:00
|
|
|
ei_device_pointer_motion(struct ei_device *device, double x, double y);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* Generate an absolute motion event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_POINTER_ABSOLUTE capability.
|
|
|
|
|
*
|
2022-03-02 15:54:15 +10:00
|
|
|
* The x/y coordinate must be within the device's regions or the event is
|
|
|
|
|
* silently discarded.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2023-06-06 10:53:16 +10:00
|
|
|
* @param x The x position in logical pixels or mm, depending on the device type
|
|
|
|
|
* @param y The y position in logical pixels or mm, depending on the device type
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_device_pointer_motion_absolute(struct ei_device *device, double x, double y);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* Generate a button event on a device with
|
2023-04-26 14:41:18 +10:00
|
|
|
* the @ref EI_DEVICE_CAP_BUTTON capability.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2022-03-04 12:20:55 +10:00
|
|
|
* Button codes must match the defines in ``linux/input-event-codes.h``
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2020-08-03 20:46:13 +10:00
|
|
|
* @param button The button code
|
2020-07-14 14:41:32 +10:00
|
|
|
* @param is_press true for button press, false for button release
|
|
|
|
|
*/
|
|
|
|
|
void
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_device_button_button(struct ei_device *device, uint32_t button, bool is_press);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2022-03-02 15:54:15 +10:00
|
|
|
* Generate a smooth (pixel-precise) scroll event on a device with
|
2023-04-26 14:41:18 +10:00
|
|
|
* the @ref EI_DEVICE_CAP_SCROLL capability.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2021-08-18 12:35:46 +10:00
|
|
|
* @note The server is responsible for emulating discrete scrolling based
|
2023-04-26 14:41:18 +10:00
|
|
|
* on the pixel value, do not call ei_device_scroll_discrete() for
|
2020-10-20 16:11:10 +10:00
|
|
|
* the same input event.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2023-06-06 10:53:16 +10:00
|
|
|
* @param x The x scroll distance in logical pixels or mm, depending on the device type
|
|
|
|
|
* @param y The y scroll distance in logical pixels or mm, depending on the device type
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* @see ei_device_scroll_discrete
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_device_scroll_delta(struct ei_device *device, double x, double y);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* Generate a discrete scroll event on a device with
|
2023-04-26 14:41:18 +10:00
|
|
|
* the @ref EI_DEVICE_CAP_SCROLL capability.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
|
|
|
|
* A discrete scroll event is based logical scroll units (equivalent to one
|
|
|
|
|
* mouse wheel click). The value for one scroll unit is 120, a fraction or
|
|
|
|
|
* multiple thereof represents a fraction or multiple of a wheel click.
|
|
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* @note The server is responsible for emulating pixel-based scrolling based
|
2023-04-26 14:41:18 +10:00
|
|
|
* on the discrete value, do not call ei_device_scroll_delta() for the
|
2020-07-14 14:41:32 +10:00
|
|
|
* same input event.
|
|
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2020-07-14 14:41:32 +10:00
|
|
|
* @param x The x scroll distance in fractions or multiples of 120
|
|
|
|
|
* @param y The y scroll distance in fractions or multiples of 120
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* @see ei_device_scroll_delta
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
|
2020-07-14 14:41:32 +10:00
|
|
|
|
2021-08-23 11:28:56 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Generate a scroll stop event on a device with the
|
|
|
|
|
* @ref EI_DEVICE_CAP_SCROLL capability.
|
2021-08-23 11:28:56 +10:00
|
|
|
*
|
|
|
|
|
* A scroll stop event notifies the server that the interaction causing a
|
2023-04-26 14:41:18 +10:00
|
|
|
* scroll motion previously triggered with ei_device_scroll_delta() or
|
|
|
|
|
* ei_device_scroll_discrete() has stopped. For example, if all
|
2021-08-23 11:28:56 +10:00
|
|
|
* fingers are lifted off a touchpad, two-finger scrolling has logically
|
|
|
|
|
* stopped.
|
|
|
|
|
*
|
|
|
|
|
* The server may use this information to e.g. start kinetic scrolling
|
|
|
|
|
* previously based on the previous finger speed.
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Use ei_device_scroll_cancel() to signal that the scroll motion has
|
2021-08-23 11:28:56 +10:00
|
|
|
* completely stopped.
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Calling ei_device_scroll_stop() after
|
|
|
|
|
* ei_device_scroll_cancel() without any of ei_device_scroll_delta()
|
|
|
|
|
* or ei_device_scroll_discrete() in between indicates a client logic bug.
|
2021-08-23 11:28:56 +10:00
|
|
|
*
|
|
|
|
|
* libei keeps track of the scroll axis and filters duplicate calls to
|
2023-04-26 14:41:18 +10:00
|
|
|
* ei_device_scroll_stop() for the same axis. A nonzero scroll or
|
2021-08-23 11:28:56 +10:00
|
|
|
* scroll-discrete value is required for the given axis to re-start scrolling
|
|
|
|
|
* for that axis.
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
2021-08-23 11:28:56 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
|
2021-08-23 11:28:56 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Generate a scroll cancel event on a device with the
|
|
|
|
|
* @ref EI_DEVICE_CAP_SCROLL capability.
|
2021-08-23 11:28:56 +10:00
|
|
|
*
|
|
|
|
|
* A scroll cancel event notifies the server that a scroll motion previously
|
2023-04-26 14:41:18 +10:00
|
|
|
* triggered with ei_device_scroll_delta() or
|
|
|
|
|
* ei_device_scroll_discrete() has ceased and no further events should
|
2021-08-23 11:28:56 +10:00
|
|
|
* be sent.
|
|
|
|
|
*
|
|
|
|
|
* This event indicates that the interaction has stopped to the point where
|
|
|
|
|
* further (server-emulated) scroll events from this device are wrong.
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Use ei_device_scroll_stop() to signal that the interaction has
|
2021-08-23 11:28:56 +10:00
|
|
|
* stopped but a server may emulate further scroll events.
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* Calling ei_device_scroll_cancel() after
|
|
|
|
|
* ei_device_scroll_stop() without any of ei_device_scroll_delta()
|
2026-03-23 12:36:22 +10:00
|
|
|
* or ei_device_scroll_discrete() in between is permitted.
|
2021-08-23 11:28:56 +10:00
|
|
|
*
|
|
|
|
|
* libei keeps track of the scroll axis and filters duplicate calls to
|
2023-04-26 14:41:18 +10:00
|
|
|
* ei_device_scroll_cancel() for the same axis. A nonzero scroll or
|
2021-08-23 11:28:56 +10:00
|
|
|
* scroll-discrete value is required for the given axis to re-start scrolling
|
|
|
|
|
* for that axis.
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
2021-08-23 11:28:56 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
|
2021-08-23 11:28:56 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-07-14 14:41:32 +10:00
|
|
|
* Generate a key event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_KEYBOARD capability.
|
|
|
|
|
*
|
|
|
|
|
* Keys use the evdev scan codes as defined in
|
2022-03-04 12:20:55 +10:00
|
|
|
* ``linux/input-event-codes.h``.
|
2020-07-14 14:41:32 +10:00
|
|
|
*
|
2022-03-02 15:54:15 +10:00
|
|
|
* Note that this is a keymap-independent key code, equivalent to the scancode
|
|
|
|
|
* a physical keyboard would produce. To generate a specific key symbol, a
|
2023-05-30 19:11:44 +10:00
|
|
|
* client must look at the keymap returned by ei_device_keyboard_get_keymap() and
|
2022-03-02 15:54:15 +10:00
|
|
|
* generate the appropriate keycodes.
|
|
|
|
|
*
|
2023-04-27 14:24:02 +10:00
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* @param device The EI device
|
2020-07-14 14:41:32 +10:00
|
|
|
* @param keycode The key code
|
|
|
|
|
* @param is_press true for key down, false for key up
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_device_keyboard_key(struct ei_device *device, uint32_t keycode, bool is_press);
|
|
|
|
|
|
2025-08-14 16:12:35 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
|
|
|
|
* Generate a key event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_TEXT capability.
|
|
|
|
|
*
|
|
|
|
|
* Keysyms use the XKB-compatible keysyms, see e.g.
|
|
|
|
|
* [/usr/include/xkbcommon/xkbcommon-keysyms.h](https://xkbcommon.org/doc/current/xkbcommon-keysyms_8h.html)
|
|
|
|
|
* for a list of key syms
|
|
|
|
|
*
|
|
|
|
|
* Note that this keysym is independent of any keymap and the keysym
|
|
|
|
|
* may not exist on any active keymap on any device. For example, a device
|
|
|
|
|
* with both @ref EI_DEVICE_CAP_TEXT and @ref EI_DEVICE_CAP_KEYBOARD is not
|
|
|
|
|
* limited to sending keysyms only present on the keymap.
|
|
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
|
|
|
|
* @param device The EI device
|
|
|
|
|
* @param keysym The keysym
|
|
|
|
|
* @param is_press true for key down, false for key up
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_device_text_keysym(struct ei_device *device, uint32_t keysym, bool is_press);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
|
|
|
|
* Generate a UTF-8 text event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_TEXT capability.
|
|
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
* This method is identical to ei_device_text_utf8_with_length()
|
|
|
|
|
* but calculates the length of the string.
|
|
|
|
|
*
|
|
|
|
|
* @param device The EI device
|
|
|
|
|
* @param text The zero-terminated UTF-8 compatible text
|
|
|
|
|
*
|
|
|
|
|
* @see ei_device_text_utf8_with_length
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_device_text_utf8(struct ei_device *device, const char *utf8);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
|
|
|
|
* Generate a UTF-8 text event on a device with
|
|
|
|
|
* the @ref EI_DEVICE_CAP_TEXT capability.
|
|
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
|
|
|
|
*
|
|
|
|
|
* This method is identical to ei_device_text_utf8()
|
|
|
|
|
* but takes an additional length argument.
|
|
|
|
|
*
|
|
|
|
|
* @param device The EI device
|
|
|
|
|
* @param text The zero-terminated UTF-8 compatible text
|
|
|
|
|
* @param length The length of text in bytes, excluding the zero bytes
|
|
|
|
|
*
|
|
|
|
|
* @see ei_device_text_utf8
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_device_text_utf8_with_length(struct ei_device *device, const char *text, size_t length);
|
|
|
|
|
|
2020-09-22 14:40:43 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-09-22 14:40:43 +10:00
|
|
|
* Initiate a new touch on a device with the @ref EI_DEVICE_CAP_TOUCH
|
|
|
|
|
* capability. This touch does not immediately send events, use
|
|
|
|
|
* ei_touch_down(), ei_touch_motion(), and ei_touch_up().
|
|
|
|
|
*
|
|
|
|
|
* The returned touch has a refcount of at least 1, use ei_touch_unref() to
|
|
|
|
|
* release resources associated with this touch
|
2023-04-27 14:24:02 +10:00
|
|
|
*
|
|
|
|
|
* This method is only available on an ei sender context.
|
2020-09-22 14:40:43 +10:00
|
|
|
*/
|
|
|
|
|
struct ei_touch *
|
|
|
|
|
ei_device_touch_new(struct ei_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-09-22 14:40:43 +10:00
|
|
|
* This function can only be called once on an ei_touch object. Further
|
|
|
|
|
* calls to ei_touch_down() on the same object are silently ignored.
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
2022-03-04 12:20:55 +10:00
|
|
|
* The x/y coordinate must be within the device's regions or the event is
|
|
|
|
|
* silently discarded.
|
2020-09-25 11:42:28 +10:00
|
|
|
*
|
|
|
|
|
* @param touch A newly created touch
|
|
|
|
|
* @param x The x position in logical pixels
|
|
|
|
|
* @param y The y position in logical pixels
|
2020-09-22 14:40:43 +10:00
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_touch_down(struct ei_touch *touch, double x, double y);
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-09-25 11:42:28 +10:00
|
|
|
* Move this touch to the new coordinates.
|
|
|
|
|
*/
|
2020-09-22 14:40:43 +10:00
|
|
|
void
|
|
|
|
|
ei_touch_motion(struct ei_touch *touch, double x, double y);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-09-22 14:40:43 +10:00
|
|
|
* Release this touch. After this call, the touch event becomes inert and
|
|
|
|
|
* no longer responds to either ei_touch_down(), ei_touch_motion() or
|
|
|
|
|
* ei_touch_up() and the caller should call ei_touch_unref().
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_touch_up(struct ei_touch *touch);
|
|
|
|
|
|
2024-11-26 13:05:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
|
|
|
|
* Cancel this touch. After this call, the touch event becomes inert and
|
|
|
|
|
* no longer responds to either ei_touch_down(), ei_touch_motion() or
|
|
|
|
|
* ei_touch_up() and the caller should call ei_touch_unref().
|
|
|
|
|
*
|
|
|
|
|
* This is only available if the EIS implementation supports version 2
|
|
|
|
|
* or later of the ei_touchscreen protocol interface. Otherwise,
|
|
|
|
|
* this function is equivalent to calling ei_touch_up().
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ei_touch_cancel(struct ei_touch *touch);
|
|
|
|
|
|
2020-10-20 16:11:10 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* Increase the refcount of this struct by one. Use ei_touch_unref() to
|
|
|
|
|
* decrease the refcount.
|
|
|
|
|
*
|
|
|
|
|
* @return the argument passed into the function
|
|
|
|
|
*/
|
2020-09-22 14:40:43 +10:00
|
|
|
struct ei_touch *
|
|
|
|
|
ei_touch_ref(struct ei_touch *touch);
|
|
|
|
|
|
2020-10-20 16:11:10 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* Decrease the refcount of this struct by one. When the refcount reaches
|
2025-07-16 13:49:15 +10:00
|
|
|
* zero, all allocated resources for this struct are released.
|
2020-10-20 16:11:10 +10:00
|
|
|
*
|
|
|
|
|
* @return always NULL
|
|
|
|
|
*/
|
2020-09-22 14:40:43 +10:00
|
|
|
struct ei_touch *
|
|
|
|
|
ei_touch_unref(struct ei_touch *touch);
|
|
|
|
|
|
2020-10-20 16:11:10 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2023-09-06 21:16:08 +00:00
|
|
|
* Set a custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_touch_get_user_data() to retrieve a previously
|
|
|
|
|
* set user data.
|
2020-10-20 16:11:10 +10:00
|
|
|
*/
|
2020-09-22 14:40:43 +10:00
|
|
|
void
|
|
|
|
|
ei_touch_set_user_data(struct ei_touch *touch, void *user_data);
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2023-09-06 21:16:08 +00:00
|
|
|
* Return the custom data pointer for this context. libei will not look at or
|
|
|
|
|
* modify the pointer. Use ei_touch_set_user_data() to change the user data.
|
2020-09-25 11:42:28 +10:00
|
|
|
*/
|
2020-10-20 16:11:10 +10:00
|
|
|
void *
|
|
|
|
|
ei_touch_get_user_data(struct ei_touch *touch);
|
2020-07-29 11:53:03 +10:00
|
|
|
|
2020-07-14 14:41:32 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-sender
|
|
|
|
|
*
|
2020-10-20 16:11:10 +10:00
|
|
|
* @return the device this touch originates on
|
2020-07-14 14:41:32 +10:00
|
|
|
*/
|
|
|
|
|
struct ei_device *
|
2020-10-20 16:11:10 +10:00
|
|
|
ei_touch_get_device(struct ei_touch *touch);
|
2020-09-25 11:42:28 +10:00
|
|
|
|
2020-09-14 17:16:50 +10:00
|
|
|
/**
|
|
|
|
|
* Return the seat from this event.
|
|
|
|
|
*
|
|
|
|
|
* For events of type @ref EI_EVENT_CONNECT and @ref EI_EVENT_DISCONNECT,
|
|
|
|
|
* this function returns NULL.
|
|
|
|
|
*
|
|
|
|
|
* This does not increase the refcount of the seat. Use eis_seat_ref()
|
|
|
|
|
* to keep a reference beyond the immediate scope.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_seat *
|
|
|
|
|
ei_event_get_seat(struct ei_event *event);
|
2023-01-30 10:31:07 +10:00
|
|
|
|
2024-12-04 11:17:56 +10:00
|
|
|
/**
|
|
|
|
|
* Returns the associated @ref ei_ping struct with this event.
|
|
|
|
|
*
|
|
|
|
|
* For events of type other than @ref EI_EVENT_PONG this function
|
|
|
|
|
* returns NULL.
|
|
|
|
|
*
|
2026-03-23 12:36:22 +10:00
|
|
|
* This does not increase the refcount of the ei_ping. Use ei_ping_ref()
|
2024-12-04 11:17:56 +10:00
|
|
|
* to keep a reference beyond the immediate scope.
|
|
|
|
|
*/
|
|
|
|
|
struct ei_ping *
|
|
|
|
|
ei_event_pong_get_ping(struct ei_event *event);
|
|
|
|
|
|
2023-01-30 10:31:07 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-01-30 10:31:07 +10:00
|
|
|
* For an event of type @ref EI_EVENT_DEVICE_START_EMULATING, return the
|
|
|
|
|
* sequence number set by the EIS implementation.
|
|
|
|
|
*
|
|
|
|
|
* See eis_device_start_emulating() for details.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_emulating_get_sequence(struct ei_event *event);
|
2021-08-24 14:49:39 +10:00
|
|
|
|
2022-02-25 14:41:28 +10:00
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_MODIFIERS, get the
|
|
|
|
|
* mask of currently logically pressed-down modifiers.
|
2023-05-30 19:11:44 +10:00
|
|
|
* See ei_device_keyboard_get_keymap() for the corresponding keymap.
|
2023-05-05 13:34:19 +10:00
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_keyboard_get_xkb_mods_depressed(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_MODIFIERS, get the
|
|
|
|
|
* mask of currently logically latched modifiers.
|
2023-05-30 19:11:44 +10:00
|
|
|
* See ei_device_keyboard_get_keymap() for the corresponding keymap.
|
2023-05-05 13:34:19 +10:00
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_keyboard_get_xkb_mods_latched(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_MODIFIERS, get the
|
|
|
|
|
* mask of currently logically locked modifiers.
|
2023-05-30 19:11:44 +10:00
|
|
|
* See ei_device_keyboard_get_keymap() for the corresponding keymap.
|
2023-05-05 13:34:19 +10:00
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_keyboard_get_xkb_mods_locked(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_MODIFIERS, get the
|
2024-12-05 21:50:24 -08:00
|
|
|
* current effective group.
|
|
|
|
|
*
|
|
|
|
|
* This may be passed to xkb_state_update_mask() as either
|
|
|
|
|
* depressed_layout (effectively pretending the user is holding down some
|
|
|
|
|
* key for this group at all times) or locked_layout (treating it as a
|
|
|
|
|
* layout the user has switched to through some mechanism), but never
|
|
|
|
|
* both at the same time. The other two layout arguments must be set to
|
|
|
|
|
* zero.
|
|
|
|
|
*
|
|
|
|
|
* Note: Because the client only knows the current effective group and
|
|
|
|
|
* not the combination of state from which it was calculated, any attempt
|
|
|
|
|
* to predict how future key presses will impact the group state will
|
|
|
|
|
* necessarily be unreliable.
|
|
|
|
|
*
|
2023-05-30 19:11:44 +10:00
|
|
|
* See ei_device_keyboard_get_keymap() for the corresponding keymap.
|
2023-05-05 13:34:19 +10:00
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_keyboard_get_xkb_group(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_POINTER_MOTION return the relative x
|
2022-03-11 10:33:54 +10:00
|
|
|
* movement in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_pointer_get_dx(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_POINTER_MOTION return the relative y
|
2022-03-11 10:33:54 +10:00
|
|
|
* movement in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_pointer_get_dy(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_POINTER_MOTION_ABSOLUTE return the x
|
2022-03-11 10:33:54 +10:00
|
|
|
* position in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_pointer_get_absolute_x(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_POINTER_MOTION_ABSOLUTE return the y
|
2022-03-11 10:33:54 +10:00
|
|
|
* position in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_pointer_get_absolute_y(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_BUTTON_BUTTON return the button
|
2022-02-25 14:41:28 +10:00
|
|
|
* code as defined in linux/input-event-codes.h
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_button_get_button(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_BUTTON_BUTTON return true if the
|
2022-02-25 14:41:28 +10:00
|
|
|
* event is a button press, false for a release.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_button_get_is_press(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_DELTA return the x scroll
|
2022-03-11 10:33:54 +10:00
|
|
|
* distance in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_dx(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_DELTA return the y scroll
|
2022-03-11 10:33:54 +10:00
|
|
|
* distance in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_dy(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_CANCEL return whether the
|
2022-02-25 14:41:28 +10:00
|
|
|
* x axis has cancelled scrolling.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_stop_x(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_STOP return whether the
|
2022-02-25 14:41:28 +10:00
|
|
|
* y axis has stopped scrolling.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_stop_y(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_DISCRETE return the x
|
2022-02-25 14:41:28 +10:00
|
|
|
* scroll distance in fractions or multiples of 120.
|
|
|
|
|
*/
|
|
|
|
|
int32_t
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_discrete_dx(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2023-04-26 14:41:18 +10:00
|
|
|
* For an event of type @ref EI_EVENT_SCROLL_DISCRETE return the y
|
2022-02-25 14:41:28 +10:00
|
|
|
* scroll distance in fractions or multiples of 120.
|
|
|
|
|
*/
|
|
|
|
|
int32_t
|
2023-04-26 14:41:18 +10:00
|
|
|
ei_event_scroll_get_discrete_dy(struct ei_event *event);
|
2022-02-25 14:41:28 +10:00
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_KEY return the key code (as
|
|
|
|
|
* defined in include/linux/input-event-codes.h).
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_keyboard_get_key(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_KEYBOARD_KEY return true if the
|
|
|
|
|
* event is a key down, false for a release.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
ei_event_keyboard_get_key_is_press(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_TOUCH_DOWN, @ref
|
|
|
|
|
* EI_EVENT_TOUCH_MOTION, or @ref EI_EVENT_TOUCH_UP, return the tracking
|
|
|
|
|
* ID of the touch.
|
|
|
|
|
*
|
|
|
|
|
* The tracking ID is a unique identifier for a touch and is valid from
|
|
|
|
|
* touch down through to touch up but may be re-used in the future.
|
|
|
|
|
* The tracking ID is randomly assigned to a touch, a client
|
|
|
|
|
* must not expect any specific value.
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_touch_get_id(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_TOUCH_DOWN, or @ref
|
2022-03-11 10:33:54 +10:00
|
|
|
* EI_EVENT_TOUCH_MOTION, return the x coordinate of the touch
|
|
|
|
|
* in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_touch_get_x(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
2023-05-05 13:34:19 +10:00
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
2022-02-25 14:41:28 +10:00
|
|
|
* For an event of type @ref EI_EVENT_TOUCH_DOWN, or @ref
|
2022-03-11 10:33:54 +10:00
|
|
|
* EI_EVENT_TOUCH_MOTION, return the y coordinate of the touch
|
|
|
|
|
* in logical pixels or mm, depending on the device type.
|
2022-02-25 14:41:28 +10:00
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
ei_event_touch_get_y(struct ei_event *event);
|
|
|
|
|
|
2024-11-26 13:05:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_TOUCH_UP
|
|
|
|
|
* return true if the event was cancelled instead of
|
|
|
|
|
* logically released.
|
|
|
|
|
*
|
|
|
|
|
* Support for touch cancellation requires the EIS implementation and client to
|
|
|
|
|
* support version 2 or later of the ei_touchscreen protocol interface.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
ei_event_touch_get_is_cancel(struct ei_event *event);
|
|
|
|
|
|
2025-08-14 16:12:35 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_TEXT_KEYSYM
|
|
|
|
|
* return the XKB-compatible keysym.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
ei_event_text_get_keysym(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_TEXT_KEYSYM
|
|
|
|
|
* return true if the event is a logical key down for the
|
|
|
|
|
* keysym.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
ei_event_text_get_keysym_is_press(struct ei_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup libei-receiver
|
|
|
|
|
*
|
|
|
|
|
* For an event of type @ref EI_EVENT_TEXT_UTF8
|
|
|
|
|
* return the zero-terminated UTF8 string.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.6
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
ei_event_text_get_utf8(struct ei_event *event);
|
|
|
|
|
|
2020-09-25 11:42:28 +10:00
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|
*/
|
2020-09-29 16:53:14 +10:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|