libei 1.3.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 <stdint.h>
33#include <stddef.h>
34
66struct oeffis;
67
72struct oeffis *
73oeffis_new(void *user_data);
74
81struct oeffis *
83
96struct oeffis *
98
104void
105oeffis_set_user_data(struct oeffis *oeffis, void *user_data);
106
111void *
113
120int
122
138int
140
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
214
223void
225
236
241const char *
243
248#ifdef __cplusplus
249}
250#endif
struct oeffis * oeffis_new(void *user_data)
Create a new oeffis context.
struct oeffis * oeffis_unref(struct oeffis *oeffis)
Decrease the refcount of this struct by one.
enum oeffis_event_type oeffis_get_event(struct oeffis *oeffis)
Return the next available event, if any.
void oeffis_set_user_data(struct oeffis *oeffis, void *user_data)
Set a custom data pointer for this context.
int oeffis_get_eis_fd(struct oeffis *oeffis)
Get a dup() of the file descriptor.
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.
struct oeffis * oeffis_ref(struct oeffis *oeffis)
Increase the refcount of this struct by one.
int oeffis_get_fd(struct oeffis *oeffis)
liboeffis keeps a single file descriptor for all events.
void oeffis_dispatch(struct oeffis *oeffis)
Process pending events.
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
The bitmask of devices to request.
Definition liboeffis.h:145
oeffis_event_type
Definition liboeffis.h:208
void oeffis_create_session(struct oeffis *oeffis, uint32_t devices)
Connect this oeffis instance to a RemoteDesktop session with the given device mask selected.
void * oeffis_get_user_data(struct oeffis *oeffis)
Return the custom data pointer for this context.
@ OEFFIS_DEVICE_POINTER
Definition liboeffis.h:159
@ OEFFIS_DEVICE_ALL_DEVICES
Request all devices.
Definition liboeffis.h:157
@ OEFFIS_DEVICE_TOUCHSCREEN
Definition liboeffis.h:160
@ OEFFIS_DEVICE_KEYBOARD
Definition liboeffis.h:158
@ OEFFIS_EVENT_CLOSED
The session was closed by the compositor or portal.
Definition liboeffis.h:211
@ OEFFIS_EVENT_DISCONNECTED
We were disconnected from the Bus due to an error.
Definition liboeffis.h:212
@ OEFFIS_EVENT_NONE
No event currently available.
Definition liboeffis.h:209
@ OEFFIS_EVENT_CONNECTED_TO_EIS
The RemoteDesktop session was created and an eis fd is available.
Definition liboeffis.h:210
The main context to interact with liboeffis.