protocol: add wl_data_device.{enter,leave}

Data device focus is currently indicated by wl_keyboard focus.
However some systems are lacking keyboards, in which case the
wl_seat is missing the keyboard capability and clients can't create
a wl_keyboard object.

Introduce enter and leave events so that compositors can indicate
when a client will receive selection events.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/37
This commit is contained in:
Simon Ser 2022-08-09 21:32:18 +02:00
parent 60827b862e
commit 0853304bc9

View file

@ -482,7 +482,7 @@
</event>
</interface>
<interface name="wl_data_offer" version="3">
<interface name="wl_data_offer" version="4">
<description summary="offer to transfer data">
A wl_data_offer represents a piece of data offered for transfer
by another client (the source client). It is used by the
@ -674,7 +674,7 @@
</event>
</interface>
<interface name="wl_data_source" version="3">
<interface name="wl_data_source" version="4">
<description summary="offer to transfer data">
The wl_data_source object is the source side of a wl_data_offer.
It is created by the source client in a data transfer and
@ -829,7 +829,7 @@
</event>
</interface>
<interface name="wl_data_device" version="3">
<interface name="wl_data_device" version="4">
<description summary="data transfer device">
There is one wl_data_device per seat which can be obtained
from the global wl_data_device_manager singleton.
@ -963,13 +963,12 @@
data_device.data_offer and the data_offer.offer events are
sent out immediately before this event to introduce the data
offer object. The selection event is sent to a client
immediately before receiving keyboard focus and when a new
selection is set while the client has keyboard focus. The
immediately before receiving data device focus and when a new
selection is set while the client has data device focus. The
data_offer is valid until a new data_offer or NULL is received
or until the client loses keyboard focus. Switching surface with
keyboard focus within the same client doesn't mean a new selection
will be sent. The client must destroy the previous selection
data_offer, if any, upon receiving this event.
or until the client loses data device focus. The client must
destroy the previous selection data_offer, if any, upon receiving
this event.
</description>
<arg name="id" type="object" interface="wl_data_offer" allow-null="true"
summary="selection data_offer object"/>
@ -982,9 +981,33 @@
This request destroys the data device.
</description>
</request>
<!-- Version 4 additions -->
<event name="enter" since="4">
<description summary="focus gained">
Notification that this seat's data device has gained focus.
The compositor must send the wl_data_device.selection event before this
event.
Before version 4, data device focus was indicated by keyboard focus.
Switching surface with keyboard focus within the same client didn't mean
a new selection event was sent.
</description>
</event>
<event name="leave" since="4">
<description summary="focus lost">
Notification that this seat's data device has lost focus.
The client will stop receiving selection events until the next enter
event.
</description>
</event>
</interface>
<interface name="wl_data_device_manager" version="3">
<interface name="wl_data_device_manager" version="4">
<description summary="data transfer interface">
The wl_data_device_manager is a singleton global object that
provides access to inter-client data transfer mechanisms such as