diff --git a/proto/protocol.xml b/proto/protocol.xml index 56b1c00..4223be7 100644 --- a/proto/protocol.xml +++ b/proto/protocol.xml @@ -86,11 +86,6 @@ - - - - - @@ -447,6 +442,20 @@ + + + + + + + + + + Bind to the bitmask of capabilities given. + + + + This seat has been removed and a client should release all @@ -462,13 +471,6 @@ - - - - - - - A bitmask of the capabilities of this seat. diff --git a/src/libei-private.h b/src/libei-private.h index 6b98108..eba1b8f 100644 --- a/src/libei-private.h +++ b/src/libei-private.h @@ -114,9 +114,6 @@ ei_send_message(struct ei *ei, uint32_t object_id, void ei_add_seat(struct ei_seat *seat); -int -ei_send_seat_bind(struct ei_seat *seat, uint32_t capabilities); - int ei_send_close_device(struct ei_device *device); diff --git a/src/libei-seat.c b/src/libei-seat.c index a96d082..aa23b0c 100644 --- a/src/libei-seat.c +++ b/src/libei-seat.c @@ -226,6 +226,20 @@ is_known_cap(enum ei_device_capability cap) return false; } +static int +ei_seat_send_bind(struct ei_seat *seat, uint32_t capabilities) +{ + struct ei *ei = ei_seat_get_context(seat); + + if (ei->state == EI_STATE_NEW || ei->state == EI_STATE_DISCONNECTED) + return 0; + + int rc = ei_seat_request_bind(seat, capabilities); + if (rc) + ei_disconnect(ei); + return rc; +} + _public_ void ei_seat_bind_capabilities(struct ei_seat *seat, ...) { @@ -255,7 +269,7 @@ ei_seat_bind_capabilities(struct ei_seat *seat, ...) return; seat->capabilities_bound = mask; - ei_send_seat_bind(seat, seat->capabilities_bound); + ei_seat_send_bind(seat, seat->capabilities_bound); } _public_ void @@ -280,7 +294,7 @@ ei_seat_unbind_capability(struct ei_seat *seat, if (ei_device_has_capability(device, cap)) ei_device_close(device); } - ei_send_seat_bind(seat, seat->capabilities_bound); + ei_seat_send_bind(seat, seat->capabilities_bound); } _public_ void @@ -312,5 +326,5 @@ ei_seat_unbind_capabilities(struct ei_seat *seat, ...) return; seat->capabilities_bound = mask; - ei_send_seat_bind(seat, seat->capabilities_bound); + ei_seat_send_bind(seat, seat->capabilities_bound); } diff --git a/src/libei.c b/src/libei.c index 3298ed0..04cd986 100644 --- a/src/libei.c +++ b/src/libei.c @@ -858,20 +858,6 @@ ei_send_stop_emulating(struct ei_device *device) return rc; } -int -ei_send_seat_bind(struct ei_seat *seat, uint32_t capabilities) -{ - struct ei *ei = ei_seat_get_context(seat); - - if (ei->state == EI_STATE_NEW || ei->state == EI_STATE_DISCONNECTED) - return 0; - - int rc = ei_connection_request_bind_seat(ei->connection, ei_seat_get_id(seat), capabilities); - if (rc) - ei_disconnect(ei); - return rc; -} - int ei_send_frame(struct ei_device *device, uint64_t time) { diff --git a/src/libeis-client.c b/src/libeis-client.c index 3ed7c1f..10fb50a 100644 --- a/src/libeis-client.c +++ b/src/libeis-client.c @@ -157,19 +157,6 @@ eis_client_find_device(struct eis_client *client, uint32_t deviceid) return NULL; } -static struct eis_seat * -eis_client_find_seat(struct eis_client *client, uint32_t seatid) -{ - struct eis_seat *seat; - - list_for_each(seat, &client->seats, link) { - if (eis_seat_get_id(seat) == seatid) - return seat; - } - - return NULL; -} - int eis_client_send_message(struct eis_client *client, uint32_t object_id, uint32_t opcode, const char *signature, size_t nargs, ...) @@ -334,18 +321,6 @@ client_msg_close_device(struct eis_connection *connection, uint32_t deviceid) return 0; } -static int -client_msg_bind_seat(struct eis_connection *connection, uint32_t seatid, uint32_t caps) -{ - struct eis_client *client = eis_connection_get_client(connection); - struct eis_seat *seat = eis_client_find_seat(client, seatid); - - if (seat) - eis_seat_bind(seat, caps); - - return seat ? 0 : -EINVAL; -} - #define DISCONNECT_IF_RECEIVER_CONTEXT(client_) do { \ if (!(client_)->is_sender) { \ struct eis *_ctx = eis_client_get_context(client_); \ @@ -598,7 +573,6 @@ static const struct eis_connection_interface intf_state_connecting = { static const struct eis_connection_interface intf_state_connected = { .sync = client_msg_sync, .disconnect = client_msg_disconnect, - .bind_seat = client_msg_bind_seat, .close_device = client_msg_close_device, /* events */ diff --git a/src/libeis-seat.c b/src/libeis-seat.c index 52f7532..f41c0be 100644 --- a/src/libeis-seat.c +++ b/src/libeis-seat.c @@ -87,8 +87,17 @@ client_msg_release(struct eis_seat *seat) return 0; } +static int +client_msg_bind(struct eis_seat *seat, uint32_t caps) +{ + eis_seat_bind(seat, caps); + + return 0; +} + static const struct eis_seat_interface interface = { .release = client_msg_release, + .bind = client_msg_bind, }; const struct eis_seat_interface *