Clipboard and selection in wayland.

Yichao Yu yyc1992 at gmail.com
Mon Mar 11 19:56:11 PDT 2013


On Mon, Mar 11, 2013 at 2:25 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> Yichao Yu wrote:
>
>> I think the middle button paste function is very different from
>> drag-and-drop. It's more like a auto-copy-clipboard. For
>> drag-and-drop, the client that starts the dnd (therefore provide the
>> data), should have focus but isn't(haven't been) necessarily selecting
>> anything. While for middle button paste (or normal clipboard), the
>> client that provide the data usually don't have the focus (unless it
>> is the same client that receives the data)
>
>
> The client that provided the data had the focus when the selection was made.
> And I have never seen a drag & drop scheme that did not either require the
> source to be selected (ie for text) or caused the item you dragged to become
> selected. So I really fail to see the difference.

It may depends on how you define selecting but the point here is the
content you start dragging should never clear the current PRIMARY
selection (use x11 name to avoid ambiguity), e.g. if you drag the
flower in the weston dnd demo, that shouldn't change what you are
going to middle-button paste next.

>
> In point-to-type the client providing the data loses the focus on the drop
> and the dropped client gets it. I think also there are clients that
> purposely grab the focus on drop.

What I want to say by mentioning focus owner here is there need to be
a "selection" owner (also x11 name) so that either the client or the
server can know where to get the data from when a client starts a
middle button paste (just like normal paste).

>
>
>> IMHO, the middle button paste should be supported by adding a set of
>> requests/events similar to those of selections to wl_data_device (just
>> like the relation between PRIMARY and CLIPBOARD selection in X11).
>> Since all toolkit support the middle button paste in x11 now, they
>> should support these just well in this way.
>
>
> Possibly but I think it is important that an attempt be made to merge the
> drag & drop into this. The middle mouse paste is far, far, more similar to
> drag & drop than cut & paste and if the api is not shared then I think there
> is a bad deficiency in wayland's design. If this means the api is shared
> with cut & paste too, then that is even better.

The name "middle button paste" already make it clear that this is a
"paste" (with auto copy and a different default shortcut) not a "dnd"
(for which the data source client doesn't need to hold the copied data
before another client does a copy). The data transfer protocol is
already shared, but these three data transfer methods (dnd, normal
copy-paste, middle button paste) should never interference with each
other, which means there must be separate event/request for them.
Since the clipboard protocol already satisfies all what needed by
middle button paste, the simplest way should be just making a copy of
that protocol (which is probably just adding one event and one
request).


More information about the wayland-devel mailing list