ei: drop ei_seat_bind_capability() and the unbind equivalent

This function is almost always wrong, very few clients will want to bind
to a single capability. Having this function means clients will use it to
bind caps one-by-one, causing the EIS implementation to create (an later
destroy) devices with capabilities that are about to be bound again anyway.
Better to have an API that encourages clients to bind all at once.

EIS implementation could avoid this by using a pingpong roundtrip in
response to a bind call, but removing this API is likely going to have
the same utility.
This commit is contained in:
Peter Hutterer 2023-05-10 09:56:47 +10:00
parent 44de97d649
commit 3e47f544c2
2 changed files with 7 additions and 38 deletions

View file

@ -249,12 +249,6 @@ ei_seat_has_capability(struct ei_seat *seat,
return false;
}
_public_ void
ei_seat_bind_capability(struct ei_seat *seat, enum ei_device_capability cap)
{
ei_seat_bind_capabilities(seat, cap, NULL);
}
static int
ei_seat_send_bind(struct ei_seat *seat, uint64_t capabilities)
{
@ -317,13 +311,6 @@ ei_seat_bind_capabilities(struct ei_seat *seat, ...)
ei_seat_send_bind(seat, seat->capabilities.bound);
}
_public_ void
ei_seat_unbind_capability(struct ei_seat *seat,
enum ei_device_capability cap)
{
ei_seat_unbind_capabilities(seat, cap, NULL);
}
_public_ void
ei_seat_unbind_capabilities(struct ei_seat *seat, ...)
{

View file

@ -249,7 +249,7 @@ enum ei_device_type {
* capability but a given device only has the pointer capability.
* Keyboard events sent through that device will be treated as client bug.
*
* If a client calls ei_seat_unbind_capability() for a capability, the EIS
* If a client calls ei_seat_unbind_capabilities() for a capability, the EIS
* implementation may remove any or all devices that have that capability.
*
* See ei_device_has_capability().
@ -839,37 +839,29 @@ ei_seat_has_capability(struct ei_seat *seat,
/**
* @ingroup libei-seat
*
* Bind this client to the given seat capability. Once bound, the server may
* Bind this client to the given seat capabilities, terminated by ``NULL``.
* Once bound, the server may
* create devices for the requested capability and send the respective @ref
* EI_EVENT_DEVICE_ADDED events. To undo, call ei_seat_unbind_capability().
* EI_EVENT_DEVICE_ADDED events. To undo, call ei_seat_unbind_capabilities().
*
* Note that binding to a capability does not guarantee a device for that
* capability becomes available. Devices may be added and removed at any time.
*
* It is an application bug to call this function for a capability already
* bound - call ei_seat_unbind_capability() first.
* bound - call ei_seat_unbind_capabilities() first.
*
* Calling this function for a capability that does not exist on the seat is
* permitted (but obviously a noop)
*/
void
ei_seat_bind_capability(struct ei_seat *seat,
enum ei_device_capability cap);
/**
* @ingroup libei-seat
*
* Same as ei_seat_bind_capability() but takes multiple capabilities,
* terminated by NULL.
*/
void
ei_seat_bind_capabilities(struct ei_seat *seat, ...)
__attribute__((sentinel));
/**
* @ingroup libei-seat
*
* Unbind a seat's capability. This function indicates the the application is
* Unbind a seat's capabilities, terminatd by ``NULL``.
* This function indicates the the application is
* no longer interested in devices with the given capability.
*
* If any devices with the given capability are present, libei automatically
@ -877,16 +869,6 @@ __attribute__((sentinel));
* @ref EI_EVENT_DEVICE_REMOVED for those devices).
*/
void
ei_seat_unbind_capability(struct ei_seat *seat,
enum ei_device_capability cap);
/**
* @ingroup libei-seat
*
* Same as ei_seat_unbind_capability() but takes multiple capabilities, terminated
* by NULL.
*/
void
ei_seat_unbind_capabilities(struct ei_seat *seat, ...)
__attribute__((sentinel));