[PATCH] protocol: Add DnD actions

Bill Spitzak spitzak at gmail.com
Thu Apr 9 16:07:01 PDT 2015


On 04/09/2015 03:12 AM, Carlos Garnacho wrote:

> No, that's precisely why my proposal involves the compositor at all,
> the source offers all actions it can handle, after
> data_device.data_offer/enter, the offer does likewise.
>
> The compositor has then a map of the actions that both parts agree on,
> and can toggle actions when the user presses modifier keys, but these
> modifier keys should only be honored if both parts recognize such
> option, it should always fall back into an action that both parts
> agree on, or the drag will be cancelled. Note that this way the
> compositor is the sole handler of pointer and keyboard events during
> DnD.

Are you proposing that it is the compositor's job to understand what 
modifier keys correspond to which actions?

I think I am failing to describe what I am proposing. Lets try to make 
this very simple. There are two lists of actions, I'll call them A and 
B. One of them is from the source, one from the destination. There is a 
function on A and B that I will call f(A,B) which returns a selected 
action, which I will call C.

You are proposing:

	source sends A to compositor
	dest sends B to compositor
	compositor does C = f(A,B)
	compositor sends C to source
	compositor sends C to dest

My proposal:

	source sends A to compositor
	compositor sends A to dest
	dest does C = f(A,B)
	dest sends C to compositor
	compositor sends C to source

The purpose is to move the implementation of f(A,B) out of the 
compositor and into the clients (removing the transmission of B, which 
changes rapidly as the target moves between widgets, is also helpful).

I figured shift keys would work by having the source rearrange the list 
of actions to put the actions selected by shift first, remove actions 
prevented by shift, and leave the fallback ones at the end. It assumes 
the dest will pick the first match.

I think what you are saying is that f() also depends on some state that 
only the compositor knows. Thus it is f(A,B,state). However the 
compositor could send state along with A to the dest.


More information about the wayland-devel mailing list