[RFC wayland-protocols 1/1] Add Primary Selection Protocol Version 1

Hans de Goede hdegoede at redhat.com
Tue Dec 15 05:07:20 PST 2015


Hi,

On 14-12-15 22:20, Lyude wrote:
> On Mon, 2015-12-14 at 10:45 -0800, Bill Spitzak wrote:
>>
>>
>> On Mon, Dec 14, 2015 at 9:13 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>>> On Mon, 14 Dec 2015 10:39:05 -0500
>>> Lyude <cpaul at redhat.com> wrote:
>>>
>>>> On Sat, 2015-12-12 at 11:29 -0800, Bill Spitzak wrote:
>>>>> I don't think you need the word "primary" in there. It can be called the
>>>>> selection. The other thing this is confused with is called the
>>> "clipboard".
>>>>>
>>>>> Glad to see you reusing the dnd protocol. X selection and middle-button
>>> paste
>>>>> is really a form of DnD, but with the advantage that the user can
>>> rearrage and
>>>>> open and close windows between when they start and finish the drag.
>>>> Alright I'm a bit confused here since I'm getting conflicting opinions on
>>> this.
>>>> Should we be reusing the dnd protocol or not? Giulio seems to think we
>>> shouldn't
>>>> be reusing the data offer objects here, but I would have thought that
>>> makes the
>>>> most sense here seeing as the functionality of a wp_primary_(offer|source)
>>> would
>>>> be pretty much identical to the wl_data_(offer|source) objects.
>>>
>>> Giulio is right.
>>>
>>> You must not break the versioning (hierarchy) of protocol objects.
>>> See:
>>> http://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning
>>>
>>> Having two different global interfaces that (or their child
>>> interfaces, i.e. the interfaces of objects that can be created from
>>> these) can create objects with the same interface will not allow
>>> that interface to be extended, because the interface version becomes
>>> ambiguous.
>>>
>>> Examples of interfaces that are already impossible to extend are
>>> wl_buffer and wl_callback. For wl_buffer there is a good reason to
>>> break the rule and take the hit of being stuck at version 1
>>> forever, but I think it was more of an accident than intentional
>>> design originally.
>> He is not creating the DnD objects with the new api, just reusing them.
>>
> *She, not he please :)
>
> Anyway, if that's the case I'll probably look into just creating an event that
> has text from the primary selection as opposed to a wl_data_offer. This would
> also get rid of the need to support non-text objects in this protocol anyway
> (which X doesn't support to begin with, so that's no big deal).

That "which X doesn't support to begin with" is not true. If you look
e.g. the clipboard code in the spice-vdagent:

http://cgit.freedesktop.org/spice/linux/vd_agent/tree/src/vdagent-x11.c#n883

(Just an example of code I happen to be familiar with) then you will see that
the handling of the primary selection and the clipboard selection is 100% identical
from a client clipboard pov. X has an (infinite) number of Selection buffers
of which in practice only the Primary and Clipboard ones are used, you can create
more if you want though :) And all these selection buffers work identical.

If you e.g. under X select a bit of text with a hyperlink in it in firefox and
then middle button paste it in libreoffice writer, the hyperlink comes along
with the text because libreoffice asks firefox in which forms the primary
selection is available by first doing a XConvertSelection with a target
of TARGETS, then sees html in the list of available formats and then
requests the _primary_ selection in html format.

Regards,

Hans


More information about the wayland-devel mailing list