libei: doc/api/liboeffis.h Source File

libei 1.6.0 A library for Emulated Input

liboeffis.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2022 Red Hat, Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#pragma once
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <stdbool.h>
32#include <stddef.h>
33#include <stdint.h>
34
52
66struct oeffis;
67
72struct oeffis *
73oeffis_new(void *user_data);
74
81struct oeffis *
82oeffis_ref(struct oeffis *oeffis);
83
96struct oeffis *
97oeffis_unref(struct oeffis *oeffis);
98
104void
105oeffis_set_user_data(struct oeffis *oeffis, void *user_data);
106
111void *
112oeffis_get_user_data(struct oeffis *oeffis);
113
120int
121oeffis_get_fd(struct oeffis *oeffis);
122
138int
139oeffis_get_eis_fd(struct oeffis *oeffis);
140
145 enum oeffis_device {
157 OEFFIS_DEVICE_ALL_DEVICES = 0,
158 OEFFIS_DEVICE_KEYBOARD = (1 << 0),
159 OEFFIS_DEVICE_POINTER = (1 << 1),
160 OEFFIS_DEVICE_TOUCHSCREEN = (1 << 2),
161};
162
198void
199oeffis_create_session(struct oeffis *oeffis, uint32_t devices);
200
205void
206oeffis_create_session_on_bus(struct oeffis *oeffis, const char *busname, uint32_t devices);
207
208 enum oeffis_event_type {
209 OEFFIS_EVENT_NONE = 0,
210 OEFFIS_EVENT_CONNECTED_TO_EIS,
212 OEFFIS_EVENT_CLOSED,
213 OEFFIS_EVENT_DISCONNECTED,
214};
215
224void
225oeffis_dispatch(struct oeffis *oeffis);
226
235enum oeffis_event_type
236oeffis_get_event(struct oeffis *oeffis);
237
242const char *
243oeffis_get_error_message(struct oeffis *oeffis);
244
248
249#ifdef __cplusplus
250}
251#endif
oeffis_new
struct oeffis * oeffis_new(void *user_data)
Create a new oeffis context.
oeffis_unref
struct oeffis * oeffis_unref(struct oeffis *oeffis)
Decrease the refcount of this struct by one.
oeffis_get_event
enum oeffis_event_type oeffis_get_event(struct oeffis *oeffis)
Return the next available event, if any.
oeffis_set_user_data
void oeffis_set_user_data(struct oeffis *oeffis, void *user_data)
Set a custom data pointer for this context.
oeffis_get_eis_fd
int oeffis_get_eis_fd(struct oeffis *oeffis)
Get a dup() of the file descriptor.
oeffis_create_session_on_bus
void oeffis_create_session_on_bus(struct oeffis *oeffis, const char *busname, uint32_t devices)
See oeffis_create_session() but this function allows to specify the busname to connect to.
oeffis_ref
struct oeffis * oeffis_ref(struct oeffis *oeffis)
Increase the refcount of this struct by one.
oeffis_get_fd
int oeffis_get_fd(struct oeffis *oeffis)
liboeffis keeps a single file descriptor for all events.
oeffis_dispatch
void oeffis_dispatch(struct oeffis *oeffis)
Process pending events.
oeffis_get_error_message
const char * oeffis_get_error_message(struct oeffis *oeffis)
If the session was OEFFIS_EVENT_DISCONNECTED, return the error message that caused the disconnection.
oeffis_device
oeffis_device
The bitmask of devices to request.
Definition liboeffis.h:145
oeffis_event_type
oeffis_event_type
Definition liboeffis.h:208
oeffis_create_session
void oeffis_create_session(struct oeffis *oeffis, uint32_t devices)
Connect this oeffis instance to a RemoteDesktop session with the given device mask selected.
oeffis_get_user_data
void * oeffis_get_user_data(struct oeffis *oeffis)
Return the custom data pointer for this context.
OEFFIS_DEVICE_POINTER
@ OEFFIS_DEVICE_POINTER
Definition liboeffis.h:159
OEFFIS_DEVICE_ALL_DEVICES
@ OEFFIS_DEVICE_ALL_DEVICES
Request all devices.
Definition liboeffis.h:157
OEFFIS_DEVICE_TOUCHSCREEN
@ OEFFIS_DEVICE_TOUCHSCREEN
Definition liboeffis.h:160
OEFFIS_DEVICE_KEYBOARD
@ OEFFIS_DEVICE_KEYBOARD
Definition liboeffis.h:158
OEFFIS_EVENT_CLOSED
@ OEFFIS_EVENT_CLOSED
The session was closed by the compositor or portal.
Definition liboeffis.h:212
OEFFIS_EVENT_DISCONNECTED
@ OEFFIS_EVENT_DISCONNECTED
We were disconnected from the Bus due to an error.
Definition liboeffis.h:213
OEFFIS_EVENT_NONE
@ OEFFIS_EVENT_NONE
No event currently available.
Definition liboeffis.h:209
OEFFIS_EVENT_CONNECTED_TO_EIS
@ OEFFIS_EVENT_CONNECTED_TO_EIS
The RemoteDesktop session was created and an eis fd is available.
Definition liboeffis.h:210
oeffis
The main context to interact with liboeffis.