Rename "accepted" to "added" for consistency with the public API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-10 08:49:22 +10:00
parent 2631854dbb
commit 6f75463261
5 changed files with 29 additions and 29 deletions

View file

@ -16,7 +16,7 @@ syntax = "proto3";
* 2.a - server replies with "Connected" or
* 2.b - server replies with "Disconnected" and closes its end of the socket
* 3. - client sends "AddDevice"
* 3.a - server replies with "Accepted" or
* 3.a - server replies with "Added" or
* 3.b - server replies with "Removed"
* 4. - client sends "PointerRelative" or any other event
* 5. - client sends "RemoveDevice"
@ -126,7 +126,7 @@ message Connected {
message Disconnected {
}
message Accepted {
message Added {
uint32 deviceid = 1;
}
@ -138,7 +138,7 @@ message ServerMessage {
oneof msg {
Connected connected = 2;
Disconnected disconnected = 3;
Accepted accepted = 4;
Added added = 4;
Removed removed = 5;
}
}

View file

@ -119,9 +119,9 @@ ei_device_remove(struct ei_device *device)
}
void
ei_device_accepted(struct ei_device *device)
ei_device_added(struct ei_device *device)
{
device->state = EI_DEVICE_STATE_ACCEPTED;
device->state = EI_DEVICE_STATE_ADDED;
}
_public_ bool
@ -145,7 +145,7 @@ ei_device_pointer_motion(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER))
return;
if (device->state != EI_DEVICE_STATE_ACCEPTED)
if (device->state != EI_DEVICE_STATE_ADDED)
return;
ei_pointer_rel(device, x, y);
@ -158,7 +158,7 @@ ei_device_pointer_button(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER))
return;
if (device->state != EI_DEVICE_STATE_ACCEPTED)
if (device->state != EI_DEVICE_STATE_ADDED)
return;
ei_pointer_button(device, button, is_press);
@ -171,7 +171,7 @@ ei_device_keyboard_key(struct ei_device *device,
if (!ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD))
return;
if (device->state != EI_DEVICE_STATE_ACCEPTED)
if (device->state != EI_DEVICE_STATE_ADDED)
return;
ei_keyboard_key(device, key, is_press);

View file

@ -59,7 +59,7 @@ struct ei {
enum ei_device_state {
EI_DEVICE_STATE_NEW,
EI_DEVICE_STATE_CONNECTING,
EI_DEVICE_STATE_ACCEPTED,
EI_DEVICE_STATE_ADDED,
EI_DEVICE_STATE_REMOVED,
};
@ -112,4 +112,4 @@ ei_keyboard_key(struct ei_device *device,
uint32_t key, bool is_press);
void
ei_device_accepted(struct ei_device *device);
ei_device_added(struct ei_device *device);

View file

@ -44,7 +44,7 @@
enum message_type {
MESSAGE_CONNECTED,
MESSAGE_DISCONNECTED,
MESSAGE_ACCEPTED,
MESSAGE_ADDED,
MESSAGE_REMOVED,
};
@ -57,9 +57,9 @@ struct message {
struct message_disconnected {
uint8_t pad; /* no data */
} disconnected;
struct message_accepted {
struct message_added {
uint32_t deviceid;
} accepted;
} added;
struct message_removed {
uint32_t deviceid;
} removed;
@ -423,13 +423,13 @@ ei_remove_device(struct ei_device *device)
}
static int
ei_accepted(struct ei *ei, uint32_t deviceid)
ei_added(struct ei *ei, uint32_t deviceid)
{
struct ei_device *d;
list_for_each(d, &ei->devices, link) {
if (d->id == deviceid) {
ei_device_accepted(d);
ei_device_added(d);
ei_queue_added_event(d);
return 0;
}
@ -560,12 +560,12 @@ connection_parse_message(const char *data, size_t *len)
.type = MESSAGE_DISCONNECTED,
};
break;
case SERVER_MESSAGE__MSG_ACCEPTED:
case SERVER_MESSAGE__MSG_ADDED:
{
Accepted *a = proto->accepted;
Added *a = proto->added;
*msg = (struct message) {
.type = MESSAGE_ACCEPTED,
.accepted.deviceid = a->deviceid,
.type = MESSAGE_ADDED,
.added.deviceid = a->deviceid,
};
}
break;
@ -596,7 +596,7 @@ connection_new_handle_msg(struct ei *ei, struct message *msg)
switch (msg->type) {
case MESSAGE_CONNECTED:
case MESSAGE_DISCONNECTED:
case MESSAGE_ACCEPTED:
case MESSAGE_ADDED:
case MESSAGE_REMOVED:
rc = -EPROTO;
break;
@ -618,7 +618,7 @@ connection_connecting_handle_msg(struct ei *ei, struct message *msg)
case MESSAGE_DISCONNECTED:
rc = -ECANCELED;
break;
case MESSAGE_ACCEPTED:
case MESSAGE_ADDED:
case MESSAGE_REMOVED:
rc = -EPROTO;
break;
@ -639,8 +639,8 @@ connection_connected_handle_msg(struct ei *ei, struct message *msg)
case MESSAGE_DISCONNECTED:
rc = -ECANCELED;
break;
case MESSAGE_ACCEPTED:
rc = ei_accepted(ei, msg->accepted.deviceid);
case MESSAGE_ADDED:
rc = ei_added(ei, msg->added.deviceid);
break;
case MESSAGE_REMOVED:
rc = ei_removed(ei, msg->removed.deviceid);

View file

@ -181,15 +181,15 @@ client_send_connect(struct eis_client *client)
}
static int
client_send_accepted(struct eis_client *client, struct eis_device *device)
client_send_added(struct eis_client *client, struct eis_device *device)
{
ServerMessage msg = SERVER_MESSAGE__INIT;
Accepted accepted = ACCEPTED__INIT;
Added added = ADDED__INIT;
accepted.deviceid = device->id;
added.deviceid = device->id;
msg.accepted = &accepted;
msg.msg_case = SERVER_MESSAGE__MSG_ACCEPTED;
msg.added = &added;
msg.msg_case = SERVER_MESSAGE__MSG_ADDED;
return client_send_msg(client, &msg);
}
@ -708,7 +708,7 @@ eis_client_new(struct eis *eis, int fd)
void
eis_client_connect_device(struct eis_client *client, struct eis_device *device)
{
client_send_accepted(client, device);
client_send_added(client, device);
}
void