diff --git a/proto/ei.proto b/proto/ei.proto index 51338b3..c561f6e 100644 --- a/proto/ei.proto +++ b/proto/ei.proto @@ -60,7 +60,7 @@ message ConfigureCapabilities { message Connect { string name = 1; - bool is_active = 2; + bool is_sender = 2; } message ConnectDone { diff --git a/src/libei-private.h b/src/libei-private.h index 0f1e3cb..4ad4aa1 100644 --- a/src/libei-private.h +++ b/src/libei-private.h @@ -68,7 +68,7 @@ struct ei { const struct ei_proto_requests *requests; - bool is_active; + bool is_sender; }; enum ei_seat_state { diff --git a/src/libei-proto.c b/src/libei-proto.c index d6d426d..835203e 100644 --- a/src/libei-proto.c +++ b/src/libei-proto.c @@ -316,7 +316,7 @@ ei_proto_send_connect(struct ei *ei) prepare_msg(CONNECT, Connect, connect); connect.name = ei->name; - connect.is_active = ei->is_active; + connect.is_sender = ei->is_sender; return ei_proto_send_msg(ei, &msg); } diff --git a/src/libei.c b/src/libei.c index 98dfcc4..7892c78 100644 --- a/src/libei.c +++ b/src/libei.c @@ -134,7 +134,7 @@ set_prop_type(struct ei *ei) } static struct ei * -ei_create_context(bool is_active, void *user_data) +ei_create_context(bool is_sender, void *user_data) { _unref_(ei) *ei = ei_create(NULL); @@ -152,7 +152,7 @@ ei_create_context(bool is_active, void *user_data) ei->user_data = user_data; ei->backend = NULL; - ei->is_active = is_active; + ei->is_sender = is_sender; set_prop_pid(ei); set_prop_cmdline(ei); @@ -162,25 +162,25 @@ ei_create_context(bool is_active, void *user_data) } _public_ bool -ei_is_active(struct ei *ei) +ei_is_sender(struct ei *ei) { - return ei->is_active; + return ei->is_sender; } _public_ struct ei * ei_new(void *user_data) { - return ei_new_active(user_data); + return ei_new_sender(user_data); } _public_ struct ei * -ei_new_active(void *user_data) +ei_new_sender(void *user_data) { return ei_create_context(true, user_data); } _public_ struct ei * -ei_new_passive(void *user_data) +ei_new_receiver(void *user_data) { return ei_create_context(false, user_data); } @@ -1038,9 +1038,9 @@ static int handle_msg_disconnected(struct ei *ei) { return -ECANCELED; } -#define DISCONNECT_IF_ACTIVE_CONTEXT(ei_) do {\ - if (ei_->is_active) { \ - log_bug_client(ei_, "Invalid event from passive EIS context. Disconnecting\n"); \ +#define DISCONNECT_IF_SENDER_CONTEXT(ei_) do {\ + if (ei_->is_sender) { \ + log_bug_client(ei_, "Invalid event from receiver EIS context. Disconnecting\n"); \ return -ECANCELED; \ } \ } while(0) @@ -1048,7 +1048,7 @@ static int handle_msg_disconnected(struct ei *ei) { static int handle_msg_start_emulating(struct ei *ei, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1061,7 +1061,7 @@ handle_msg_start_emulating(struct ei *ei, uint32_t deviceid) static int handle_msg_stop_emulating(struct ei *ei, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1074,7 +1074,7 @@ handle_msg_stop_emulating(struct ei *ei, uint32_t deviceid) static int handle_msg_frame(struct ei *ei, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1088,7 +1088,7 @@ static int handle_msg_pointer_rel(struct ei *ei, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1102,7 +1102,7 @@ static int handle_msg_pointer_abs(struct ei *ei, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1116,7 +1116,7 @@ static int handle_msg_pointer_button(struct ei *ei, uint32_t deviceid, uint32_t button, bool state) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1130,7 +1130,7 @@ static int handle_msg_pointer_scroll(struct ei *ei, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1144,7 +1144,7 @@ static int handle_msg_pointer_scroll_discrete(struct ei *ei, uint32_t deviceid, int32_t x, int32_t y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1158,7 +1158,7 @@ static int handle_msg_pointer_scroll_stop(struct ei *ei, uint32_t deviceid, bool x, bool y, bool is_cancel) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1176,7 +1176,7 @@ static int handle_msg_keyboard_key(struct ei *ei, uint32_t deviceid, uint32_t key, bool state) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1190,7 +1190,7 @@ static int handle_msg_touch_down(struct ei *ei, uint32_t deviceid, uint32_t touchid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1204,7 +1204,7 @@ static int handle_msg_touch_motion(struct ei *ei, uint32_t deviceid, uint32_t touchid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); @@ -1217,7 +1217,7 @@ handle_msg_touch_motion(struct ei *ei, uint32_t deviceid, static int handle_msg_touch_up(struct ei *ei, uint32_t deviceid, uint32_t touchid) { - DISCONNECT_IF_ACTIVE_CONTEXT(ei); + DISCONNECT_IF_SENDER_CONTEXT(ei); struct ei_device *device = ei_find_device(ei, deviceid); diff --git a/src/libei.h b/src/libei.h index 202d4ef..4eb756d 100644 --- a/src/libei.h +++ b/src/libei.h @@ -38,11 +38,12 @@ extern "C" { * libei is the client-side module. This API should be used by processes * that need to emulate devices. * - * libei clients come in "active" and "passive" modes, depending on whether - * the client sends or receives events. A libeis context however is both - * active and passive at the same time, it is up to the implementation to - * disconnect clients that it does not want to allow. See - * eis_client_is_active() for details. + * libei clients come in "sender" and "receiver" modes, depending on whether + * the client sends or receives events. A libeis context however may accept + * both sender and receiver clients, the EIS implementation works as + * corresponding receiver or sender for this client. It is up to the + * implementation to disconnect clients that it does not want to allow. See + * eis_client_is_sender() for details. * * @{ */ @@ -316,7 +317,7 @@ enum ei_event_type { * and notifies the client that the previous set of events belong to * the same logical hardware event. * - * These events are only generated on a passive ei context. + * These events are only generated on a receiver ei context. * * This event is most commonly used to implement multitouch (multiple * touches may update within the same hardware scanout cycle). @@ -328,7 +329,7 @@ enum ei_event_type { * be used by the client to clear the logical state of the emulated * devices and/or provide UI to the user. * - * These events are only generated on a passive ei context. + * These events are only generated on a receiver ei context. * * Note that a server start multiple emulating sequences * simultaneously, depending on the devices available. @@ -339,7 +340,7 @@ enum ei_event_type { EI_EVENT_DEVICE_START_EMULATING = 200, EI_EVENT_DEVICE_STOP_EMULATING, - /* These events are only generated on a passive ei context. */ + /* These events are only generated on a receiver ei context. */ EI_EVENT_POINTER_MOTION = 300, EI_EVENT_POINTER_MOTION_ABSOLUTE, EI_EVENT_POINTER_BUTTON, @@ -356,16 +357,16 @@ enum ei_event_type { }; /** - * This is an alias for @ref ei_new_active. + * This is an alias for @ref ei_new_sender. */ struct ei * ei_new(void *user_data); /** - * Create a new active ei context. The context is refcounted and must be + * Create a new sender ei context. The context is refcounted and must be * released with ei_unref(). * - * An active ei context sends events to the EIS implementation but cannot + * A sender ei context sends events to the EIS implementation but cannot * receive events. * * A context supports exactly one backend, set up with one of @@ -379,13 +380,13 @@ ei_new(void *user_data); * @see ei_setup_backend_socket */ struct ei * -ei_new_active(void *user_data); +ei_new_sender(void *user_data); /** - * Create a new passive ei context. The context is refcounted and must be + * Create a new receiver ei context. The context is refcounted and must be * released with ei_unref(). * - * A passive ei context receives events from the EIS implementation but cannot + * A receiver ei context receives events from the EIS implementation but cannot * send events. * * A context supports exactly one backend, set up with one of @@ -399,10 +400,10 @@ ei_new_active(void *user_data); * @see ei_setup_backend_socket */ struct ei * -ei_new_passive(void *user_data); +ei_new_receiver(void *user_data); bool -ei_is_active(struct ei *ei); +ei_is_sender(struct ei *ei); enum ei_log_priority { EI_LOG_PRIORITY_DEBUG = 10, @@ -936,13 +937,13 @@ ei_device_get_name(struct ei_device *device); /** * The device type of the device is determined by the type of the ei - * context. If the client context was created with ei_new_active(), the device + * context. If the client context was created with ei_new_sender(), the device * type defaults to @ref EI_DEVICE_TYPE_VIRTUAL. If the client context was - * created with ei_new_passive(), the device type defaults to @ref + * created with ei_new_receiver(), the device type defaults to @ref * EI_DEVICE_TYPE_PHYSICAL. * - * libei does not currently support virtual devices on a passive context or - * physical devices on an active context. This may change in the future, + * libei does not currently support virtual devices on a receiver context or + * physical devices on an sender context. This may change in the future, * applications should not rely on the type being fixed. */ enum ei_device_type diff --git a/src/libeis-client.c b/src/libeis-client.c index 2ec40d2..4700c58 100644 --- a/src/libeis-client.c +++ b/src/libeis-client.c @@ -80,9 +80,9 @@ eis_client_get_context(struct eis_client *client) } _public_ bool -eis_client_is_active(struct eis_client *client) +eis_client_is_sender(struct eis_client *client) { - return client->is_active; + return client->is_sender; } static struct eis_device * @@ -263,10 +263,10 @@ client_msg_bind_seat(struct eis_client *client, uint32_t seatid, uint32_t caps) return seat ? 0 : -EINVAL; } -#define DISCONNECT_IF_ACTIVE_CONTEXT(client_) do { \ - if (!(client_)->is_active) { \ +#define DISCONNECT_IF_RECEIVER_CONTEXT(client_) do { \ + if (!(client_)->is_sender) { \ struct eis *_ctx = eis_client_get_context(client_); \ - log_bug_client(_ctx, "Invalid event from passive ei context. Disconnecting client\n"); \ + log_bug_client(_ctx, "Invalid event from receiver ei context. Disconnecting client\n"); \ return -EINVAL; \ } \ } while(0) @@ -274,7 +274,7 @@ client_msg_bind_seat(struct eis_client *client, uint32_t seatid, uint32_t caps) static int client_msg_start_emulating(struct eis_client *client, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -287,7 +287,7 @@ client_msg_start_emulating(struct eis_client *client, uint32_t deviceid) static int client_msg_stop_emulating(struct eis_client *client, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -300,7 +300,7 @@ client_msg_stop_emulating(struct eis_client *client, uint32_t deviceid) static int client_msg_frame(struct eis_client *client, uint32_t deviceid) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -314,7 +314,7 @@ static int client_msg_pointer_rel(struct eis_client *client, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -328,7 +328,7 @@ static int client_msg_pointer_abs(struct eis_client *client, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -342,7 +342,7 @@ static int client_msg_pointer_button(struct eis_client *client, uint32_t deviceid, uint32_t button, bool state) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -356,7 +356,7 @@ static int client_msg_pointer_scroll(struct eis_client *client, uint32_t deviceid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -370,7 +370,7 @@ static int client_msg_pointer_scroll_discrete(struct eis_client *client, uint32_t deviceid, int32_t x, int32_t y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -384,7 +384,7 @@ static int client_msg_pointer_scroll_stop(struct eis_client *client, uint32_t deviceid, bool x, bool y, bool is_cancel) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -402,7 +402,7 @@ static int client_msg_keyboard_key(struct eis_client *client, uint32_t deviceid, uint32_t key, bool state) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -416,7 +416,7 @@ static int client_msg_touch_down(struct eis_client *client, uint32_t deviceid, uint32_t touchid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -430,7 +430,7 @@ static int client_msg_touch_motion(struct eis_client *client, uint32_t deviceid, uint32_t touchid, double x, double y) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -443,7 +443,7 @@ client_msg_touch_motion(struct eis_client *client, uint32_t deviceid, static int client_msg_touch_up(struct eis_client *client, uint32_t deviceid, uint32_t touchid) { - DISCONNECT_IF_ACTIVE_CONTEXT(client); + DISCONNECT_IF_RECEIVER_CONTEXT(client); struct eis_device *device = eis_client_find_device(client, deviceid); @@ -479,12 +479,12 @@ client_msg_configure_capabilities(struct eis_client *client, uint32_t allowed_ca } static int -client_msg_connect(struct eis_client *client, const char *name, bool is_active) +client_msg_connect(struct eis_client *client, const char *name, bool is_sender) { if (client->name == NULL) client->name = xstrdup(name); - client->is_active = is_active; + client->is_sender = is_sender; return 0; } @@ -619,7 +619,7 @@ eis_client_new(struct eis *eis, int fd) static uint32_t client_id; struct eis_client *client = eis_client_create(&eis->object); - client->is_active = true; + client->is_sender = true; client->id = ++client_id; list_init(&client->seats); list_init(&client->seats_pending); diff --git a/src/libeis-private.h b/src/libeis-private.h index b746e2a..5e38cb9 100644 --- a/src/libeis-private.h +++ b/src/libeis-private.h @@ -71,7 +71,7 @@ struct eis_client { uint32_t id; enum eis_client_state state; char *name; - bool is_active; + bool is_sender; struct list seats; struct list seats_pending; diff --git a/src/libeis-proto.c b/src/libeis-proto.c index 5288d03..da51aab 100644 --- a/src/libeis-proto.c +++ b/src/libeis-proto.c @@ -511,7 +511,7 @@ eis_proto_handle_message(struct eis_client *client, int rc; switch (proto->msg_case) { case CLIENT_MESSAGE__MSG_CONNECT: - rc = call(connect, client, proto->connect->name, proto->connect->is_active); + rc = call(connect, client, proto->connect->name, proto->connect->is_sender); break; case CLIENT_MESSAGE__MSG_CONNECT_DONE: rc = call(connect_done, client); diff --git a/src/libeis-proto.h b/src/libeis-proto.h index c7adb41..9927588 100644 --- a/src/libeis-proto.h +++ b/src/libeis-proto.h @@ -36,7 +36,7 @@ /* callbacks invoked during eis_proto_parse_message() */ struct eis_proto_interface { - int (*connect)(struct eis_client *client, const char *name, bool is_active); + int (*connect)(struct eis_client *client, const char *name, bool is_sender); int (*connect_done)(struct eis_client *client); int (*disconnect)(struct eis_client *client); int (*bind_seat)(struct eis_client *client, uint32_t seatid, enum eis_device_capability cap); diff --git a/src/libeis.h b/src/libeis.h index 661e58c..b903888 100644 --- a/src/libeis.h +++ b/src/libeis.h @@ -39,16 +39,17 @@ extern "C" { * libeis is the server-side module. This API should be used by processes * that have control over input devices, e.g. Wayland compositors. * - * libei clients come in "active" and "passive" modes, depending on whether - * the client sends or receives events. A libeis context however is both - * active and passive at the same time, it is up to the implementation to - * disconnect clients that it does not want to allow. See - * eis_client_is_active() for details. + * libei clients come in "sender" and "receiver" modes, depending on whether + * the client sends or receives events. A libeis context however may accept + * both sender and receiver clients, the EIS implementation works as + * corresponding receiver or sender for this client. It is up to the + * implementation to disconnect clients that it does not want to allow. See + * eis_client_is_sender() for details. * - * Note that usually the differentiation between active and passive client - * has an effect on the devices that should be sent to the client. Active + * Note that usually the differentiation between sender and receiver client + * has an effect on the devices that should be sent to the client. Sender * clients typically expect devices representing the available screen area so - * they can control input, passive clients typically expect devices + * they can control input, receiver clients typically expect devices * representing the physical input devices. * * @{ @@ -181,7 +182,7 @@ enum eis_event_type { * and notifies the server that the previous set of events belong to * the same logical hardware event. * - * These events are only generated on a passive EIS context. + * These events are only generated on a receiving EIS context. * * This event is most commonly used to implement multitouch (multiple * touches may update within the same hardware scanout cycle). @@ -193,7 +194,7 @@ enum eis_event_type { * be used by the server to clear the logical state of the emulated * devices and/or provide UI to the user. * - * These events are only generated on a passive EIS context. + * These events are only generated on a receiving EIS context. * * Note that a client start multiple emulating sequences * simultaneously, depending on the devices it received from the @@ -210,7 +211,7 @@ enum eis_event_type { */ EIS_EVENT_DEVICE_STOP_EMULATING, - /* These events are only generated on a passive EIS context */ + /* These events are only generated on a receiving EIS context */ /** * A relative motion event with delta coordinates in logical pixels or @@ -331,12 +332,12 @@ void eis_set_user_data(struct eis *eis, void *user_data); /** - * Returns true if the client is active, false otherwise. An active client may - * send events to the EIS implementation, a passive client expects to receive + * Returns true if the client is a sender, false otherwise. A sender client may + * send events to the EIS implementation, a receiver client expects to receive * events from the EIS implementation. */ bool -eis_client_is_active(struct eis_client *client); +eis_client_is_sender(struct eis_client *client); /** * See eis_client_property_set_with_permissions(), but the permissions are diff --git a/src/util-sources.c b/src/util-sources.c index 2f2e8c0..32a46a2 100644 --- a/src/util-sources.c +++ b/src/util-sources.c @@ -54,7 +54,7 @@ struct source { void *user_data; enum source_close_behavior close_behavior; int fd; - bool is_active; + bool is_sender; }; OBJECT_IMPLEMENT_REF(source); @@ -70,13 +70,13 @@ OBJECT_IMPLEMENT_SETTER(source, user_data, void*); void source_remove(struct source *source) { - if (!source || !source->is_active) + if (!source || !source->is_sender) return; epoll_ctl(source->sink->epollfd, EPOLL_CTL_DEL, source->fd, NULL); if (source->close_behavior == SOURCE_CLOSE_FD_ON_REMOVE) source->fd = xclose(source->fd); - source->is_active = false; + source->is_sender = false; source_unref(source); /* Note: sources list was the owner of the source, new owner @@ -91,7 +91,7 @@ static void source_destroy(struct source *source) { /* We expect source_remove() to be called before we ever get here */ - assert(!source->is_active); + assert(!source->is_sender); if (source->close_behavior == SOURCE_CLOSE_FD_ON_DESTROY) source->fd = xclose(source->fd); @@ -109,7 +109,7 @@ source_new(int sourcefd, source_dispatch_t dispatch, void *user_data) source->user_data = user_data; source->fd = sourcefd; source->close_behavior = SOURCE_CLOSE_FD_ON_REMOVE; - source->is_active = false; + source->is_sender = false; list_init(&source->link); return source; @@ -202,7 +202,7 @@ sink_add_source(struct sink *sink, struct source *source) return -errno; } - source->is_active = true; + source->is_sender = true; source->sink = sink; source_ref(source); list_append(&sink->sources, &source->link); diff --git a/test/eierpecken.c b/test/eierpecken.c index 9944a36..3e24242 100644 --- a/test/eierpecken.c +++ b/test/eierpecken.c @@ -318,13 +318,13 @@ peck_new_context(enum peck_ei_mode ei_mode) { struct peck *peck = peck_create(NULL); - assert(ei_mode == PECK_EI_PASSIVE || ei_mode == PECK_EI_ACTIVE); + assert(ei_mode == PECK_EI_RECEIVER || ei_mode == PECK_EI_SENDER); int sv[2]; int rc = socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0, sv); munit_assert_int(rc, ==, 0); - struct ei *ei = ei_mode == PECK_EI_PASSIVE ? ei_new_passive(peck) : ei_new_active(peck); + struct ei *ei = ei_mode == PECK_EI_RECEIVER ? ei_new_receiver(peck) : ei_new_sender(peck); ei_set_user_data(ei, peck); ei_log_set_handler(ei, peck_ei_log_handler); ei_log_set_priority(ei, EI_LOG_PRIORITY_DEBUG); @@ -357,7 +357,7 @@ peck_new_context(enum peck_ei_mode ei_mode) struct peck * peck_new(void) { - return peck_new_context(PECK_EI_ACTIVE); + return peck_new_context(PECK_EI_SENDER); } void @@ -856,7 +856,7 @@ _peck_dispatch_ei(struct peck *peck, int lineno) case EI_EVENT_DEVICE_RESUMED: if (flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_AUTOSTART)) { struct ei_device *device = ei_event_get_device(e); - if (ei_is_active(ei_device_get_context(device))) + if (ei_is_sender(ei_device_get_context(device))) ei_device_start_emulating(device); } break; diff --git a/test/eierpecken.h b/test/eierpecken.h index ae0561e..0bb26b3 100644 --- a/test/eierpecken.h +++ b/test/eierpecken.h @@ -32,8 +32,8 @@ #include "util-mem.h" enum peck_ei_mode { - PECK_EI_PASSIVE = 20, - PECK_EI_ACTIVE, + PECK_EI_RECEIVER = 20, + PECK_EI_SENDER, }; /** diff --git a/test/test-ei-device.c b/test/test-ei-device.c index 861a1b5..2177d9d 100644 --- a/test/test-ei-device.c +++ b/test/test-ei-device.c @@ -1150,7 +1150,7 @@ MUNIT_TEST(test_ei_keyboard_modifiers) MUNIT_TEST(test_passive_ei_device_start_stop_emulating) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_NONE); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_DEFAULT_SEAT); @@ -1186,7 +1186,7 @@ MUNIT_TEST(test_passive_ei_device_start_stop_emulating) MUNIT_TEST(test_passive_ei_device_stop_emulating_when_removing) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_NONE); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_DEFAULT_SEAT); @@ -1225,7 +1225,7 @@ MUNIT_TEST(test_passive_ei_device_stop_emulating_when_removing) /* Same as test_passive_ei_device_pointer_rel() but for a passive context */ MUNIT_TEST(test_passive_ei_device_keyboard_key) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_KEYBOARD); @@ -1272,7 +1272,7 @@ MUNIT_TEST(test_passive_ei_device_keyboard_key) /* Same as test_ei_device_pointer_rel() but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_rel) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_POINTER); @@ -1326,7 +1326,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_rel) /* Same as test_ei_device_pointer_abs() but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_abs) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); struct eis_device *device = NULL; peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); @@ -1407,7 +1407,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_abs) /* same as test_ei_device_pointer_scroll but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_scroll) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_POINTER); @@ -1454,7 +1454,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll) /* same as test_ei_device_pointer_scroll_stop but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_POINTER); @@ -1536,7 +1536,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop) /* same as test_ei_device_pointer_scroll_cancel but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_scroll_cancel) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_POINTER); @@ -1618,7 +1618,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_cancel) /* same as test_ei_device_pointer_scroll_stop_cancel but for a passive context */ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop_cancel) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_POINTER); @@ -1689,7 +1689,7 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop_cancel) /* same as test_ei_device_touch but for a passive context */ MUNIT_TEST(test_passive_ei_device_touch) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); struct eis_device *device = NULL; uint32_t maxx = 0, maxy = 0; @@ -1874,7 +1874,7 @@ MUNIT_TEST(test_passive_ei_device_touch) /* same as test_ei_device_multitouch but for a passive context */ MUNIT_TEST(test_passive_ei_device_multitouch) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_TOUCH); diff --git a/test/test-ei.c b/test/test-ei.c index ba79818..855fa7a 100644 --- a/test/test-ei.c +++ b/test/test-ei.c @@ -868,9 +868,9 @@ MUNIT_TEST(test_ei_disconnect_after_unbind_after_received) return MUNIT_OK; } -MUNIT_TEST(test_client_is_active) +MUNIT_TEST(test_client_is_sender) { - _unref_(peck) *peck = peck_new_context(PECK_EI_ACTIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_SENDER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_NONE); peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_NONE); @@ -880,15 +880,15 @@ MUNIT_TEST(test_client_is_active) with_server(peck) { _unref_(eis_event) *connect = peck_eis_next_event(eis, EIS_EVENT_CLIENT_CONNECT); struct eis_client *client = eis_event_get_client(connect); - munit_assert_true(eis_client_is_active(client)); + munit_assert_true(eis_client_is_sender(client)); } return MUNIT_OK; } -MUNIT_TEST(test_client_is_passive) +MUNIT_TEST(test_client_is_receiver) { - _unref_(peck) *peck = peck_new_context(PECK_EI_PASSIVE); + _unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER); peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_NONE); peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_NONE); @@ -898,7 +898,7 @@ MUNIT_TEST(test_client_is_passive) with_server(peck) { _unref_(eis_event) *connect = peck_eis_next_event(eis, EIS_EVENT_CLIENT_CONNECT); struct eis_client *client = eis_event_get_client(connect); - munit_assert_false(eis_client_is_active(client)); + munit_assert_false(eis_client_is_sender(client)); } return MUNIT_OK; diff --git a/tools/ei-demo-client.c b/tools/ei-demo-client.c index af964d6..4b237e6 100644 --- a/tools/ei-demo-client.c +++ b/tools/ei-demo-client.c @@ -177,7 +177,7 @@ usage(FILE *fp, const char *argv0) " --portal Use the portal backend.\n" " --busname Use the given busname (default: org.freedesktop.portal.Desktop)\n" " --verbose Enable debugging output\n" - " --passive Create an passive EIS context, receiving events instead of sending them\n" + " --receiver Create a receiver EIS context, receiving events instead of sending them\n" "", argv0); } @@ -189,7 +189,7 @@ int main(int argc, char **argv) PORTAL, } backend = SOCKET; bool verbose = false; - bool passive = false; + bool receiver = false; _cleanup_free_ char *busname = xstrdup("org.freedesktop.portal.Desktop"); while (1) { @@ -198,14 +198,14 @@ int main(int argc, char **argv) OPT_BACKEND_PORTAL, OPT_BUSNAME, OPT_VERBOSE, - OPT_PASSIVE, + OPT_RECEIVER, }; static struct option long_opts[] = { {"socket", no_argument, 0, OPT_BACKEND_SOCKET}, {"portal", no_argument, 0, OPT_BACKEND_PORTAL}, {"busname", required_argument, 0, OPT_BUSNAME}, {"verbose", no_argument, 0, OPT_VERBOSE}, - {"passive", no_argument, 0, OPT_PASSIVE}, + {"receiver", no_argument, 0, OPT_RECEIVER}, {"help", no_argument, 0, 'h'}, {.name = NULL}, }; @@ -232,8 +232,8 @@ int main(int argc, char **argv) free(busname); busname = xstrdup(optarg); break; - case OPT_PASSIVE: - passive = true; + case OPT_RECEIVER: + receiver = true; break; default: usage(stderr, argv[0]); @@ -242,10 +242,10 @@ int main(int argc, char **argv) } _unref_(ei) *ei = NULL; - if (passive) - ei = ei_new_passive(NULL); + if (receiver) + ei = ei_new_receiver(NULL); else - ei = ei_new_active(NULL); + ei = ei_new_sender(NULL); assert(ei); if (verbose) @@ -346,19 +346,19 @@ int main(int argc, char **argv) break; case EI_EVENT_DEVICE_RESUMED: if (ei_event_get_device(e) == ptr) { - if (!passive) + if (!receiver) ei_device_start_emulating(ptr); colorprint("Pointer device was resumed\n"); have_ptr = true; } if (ei_event_get_device(e) == kbd) { - if (!passive) + if (!receiver) ei_device_start_emulating(kbd); colorprint("Keyboard device was resumed\n"); have_kbd = true; } if (ei_event_get_device(e) == abs) { - if (!passive) + if (!receiver) ei_device_start_emulating(abs); colorprint("Abs pointer device was resumed\n"); have_abs = true; @@ -444,7 +444,7 @@ int main(int argc, char **argv) } } - if (!passive) { + if (!receiver) { if (have_ptr) { colorprint("sending motion event\n"); ei_device_pointer_motion(ptr, -1, 1); diff --git a/tools/eis-demo-server.c b/tools/eis-demo-server.c index 785a69d..d9de590 100644 --- a/tools/eis-demo-server.c +++ b/tools/eis-demo-server.c @@ -216,7 +216,7 @@ add_device(struct eis_demo_server *server, struct eis_client *client, eis_client_get_name(client)); eis_device_add(ptr); eis_device_resume(ptr); - if (!eis_client_is_active(client)) + if (!eis_client_is_sender(client)) eis_device_start_emulating(ptr); device = steal(&ptr); break; @@ -234,7 +234,7 @@ add_device(struct eis_demo_server *server, struct eis_client *client, eis_client_get_name(client)); eis_device_add(abs); eis_device_resume(abs); - if (!eis_client_is_active(client)) + if (!eis_client_is_sender(client)) eis_device_start_emulating(abs); device = steal(&abs); break; @@ -250,7 +250,7 @@ add_device(struct eis_demo_server *server, struct eis_client *client, eis_client_get_name(client)); eis_device_add(kbd); eis_device_resume(kbd); - if (!eis_client_is_active(client)) + if (!eis_client_is_sender(client)) eis_device_start_emulating(kbd); device = steal(&kbd); break; @@ -281,9 +281,9 @@ eis_demo_server_printf_handle_event(struct eis_demo_server *server, const char *pid = eis_client_property_get(client, "ei.application.pid"); const char *cmdline = eis_client_property_get(client, "ei.application.cmdline"); const char *ctype = eis_client_property_get(client, "ei.connection.type"); - bool is_active = eis_client_is_active(client); + bool is_sender = eis_client_is_sender(client); colorprint("new %s client: %s (pid %s, '%s'), connected via %s\n", - is_active ? "active" : "passive", + is_sender ? "sender" : "receiver", eis_client_get_name(client), pid, cmdline, ctype); @@ -454,7 +454,7 @@ usage(FILE *fp, const char *argv0) " --layout Use the given XKB layout (requires libxkbcommon). Default: none\n" " --uinput Set up each device as uinput device (this requires root)\n" " --verbose Enable debugging output\n" - " --active Make this an active EIS server, sending events instead of receiving them\n" + " --sender Make this a sender EIS server, sending events instead of receiving them\n" "", argv0); } @@ -575,7 +575,7 @@ int main(int argc, char **argv) struct eis_demo_client *democlient; list_for_each(democlient, &server.clients, link) { - if (eis_client_is_active(democlient->client)) + if (eis_client_is_sender(democlient->client)) continue; struct eis_device *ptr = democlient->ptr;