[PATCH wayland 2/2] protocol: Add DnD actions

Carlos Garnacho carlosg at gnome.org
Sat Jan 16 04:37:26 PST 2016


Hi Jonas!

On Sat, Jan 16, 2016 at 9:37 AM, Jonas Ådahl <jadahl at gmail.com> wrote:
> On Fri, Jan 15, 2016 at 02:49:33PM -0800, Bryce Harrington wrote:
>> On Fri, Jan 15, 2016 at 09:11:40PM +0100, Carlos Garnacho wrote:
>> > These 2 requests have been added:
>> >
>> > - wl_data_source.set_actions: Notifies the compositor of the available
>> >   actions on the data source.
>> > - wl_data_offer.set_actions: Notifies the compositor of the available
>> >   actions on the destination side, plus the preferred action.
>> >
>> > Out of the data from these requests, the compositor can determine the action
>> > both parts agree on (and let the user play a role through eg. keyboard
>> > modifiers). The chosen option will be notified to both parties
>> > through the following two requests:
>> >
>> > - wl_data_source.action
>> > - wl_data_offer.action
>> >
>> > In addition, the destination side can peek the source side actions through
>> > wl_data_offer.source_actions.
>> >
>> > Compared to the XDND protocol, there's two notable changes:
>> >
>> > - XDND lets the source suggest an action, whereas wl_data_device lets
>> >   the destination prefer a given action. The difference is subtle here,
>> >   it comes off as convenience because it is the drag destination which
>> >   receives the motion events (unlike in X) and can perform action updates.
>> >
>> >   The drag destination seems also in a better position to update the
>> >   preferred action based on things like the data being transferred, the
>> >   place being dropped, and whether the drag is client-local.
>> >
>> > - That same source-side preferred action is used in XDND to convey the
>> >   modifier-induced action to the drag destination, which would then ack
>> >   it, or reply with another action that's accepted (or none), this makes
>> >   the XdndPosition/XdndStatus messaging very verbose, and synchronous
>> >   because the drag source always needs to know the latest status/action
>> >   for every position+action sent.
>> >
>> >   Here it's the compositor which takes care of modifiers and matching
>> >   available/accepted actions, this allows for the signaling to happen
>> >   only whenever the actions/modifiers change for real.
>> >
>> > Roughly based on previous work by Giulio Camuffo <giuliocamuffo at gmail.com>
>> >
>> > Changes since v10:
>> > - Narrow down the situations where wl_data_source/offer.accept requests
>> >   are supposed to happen.
>> >
>> > Changes since v9:
>> > - Deferred the protocol errors to .finish after some IRC chat with Jonas,
>> >   added further errors if actions API is used on selection sources/offers.
>> >
>> > Changes since v8:
>> > - Defined further the expected behavior on "ask", described the protocol
>> >   errors that may happen. Fix more spaces vs tabs issues.
>> >
>> > Changes since v7:
>> > - Misc changes after updating the progress notification patch.
>> >
>> > Changes since v6:
>> > - Further explanations on wl_data_source/offer.set_actions, including a
>> >   description of "ask" actions. Added protocol errors for unknown action
>> >   values.
>> >
>> > Changes since v5:
>> > - Applied rewording suggestions from Jonas Ådahl. Dropped slot reservation
>> >   scheme for actions. Fixed indentation and other minor formatting issues.
>> >
>> > Changes since v4:
>> > - Minor rewording.
>> >
>> > Changes since v3:
>> > - Splitted from DnD progress notification changes.
>> > - Further rationales in commit log.
>> >
>> > Changes since v2:
>> > - Renamed notify_actions to set_actions on both sides, seems more consistent
>> >   with the rest of the protocol.
>> > - Spelled out better which events may be triggered on the compositor side
>> >   by the requests, the circumstances in which events are emitted, and
>> >   what are events useful for in clients.
>> > - Defined a minimal common ground wrt compositor-side action picking and
>> >   keybindings.
>> > - Acknowledge the possibility of compositor/toolkit defined actions, even
>> >   though none are used at the moment.
>> > Changes since v1:
>> > - Added wl_data_offer.source_actions to let know of the actions offered
>> >   by a data source.
>> > - Renamed wl_data_source.finished to "drag_finished" for clarity
>> > - Improved wording as suggested by Bryce
>> >
>> > Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
>> > Reviewed-by: Michael Catanzaro <mcatanzaro at igalia.com>
>> > Reviewed-by: Mike Blumenkrantz <zmike at samsung.com>
>> > Reviewed-by: Jonas Ådahl <jadahl at gmail.com>
>>
>> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
>
> I have now landed the two protocol patches after having fixed the grammar
> nitpicks. Carlos, it'd be good if you could just double check I did the
> right choices where there were options.

Yay! Thanks for doing that. Checking the diff everything looked great,
only spotted one thing that eluded reviews in the last paragraph of
wl_data_offer.action:

+       may potentially choose different a different action and/or mime type,

"different" is repeated, the first one can be removed. This mistake
was there also in my patches fwiw.

Cheers,
  Carlos


More information about the wayland-devel mailing list