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

Pekka Paalanen ppaalanen at gmail.com
Sun Dec 13 23:59:39 PST 2015


On Fri, 11 Dec 2015 11:04:07 +0200
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:

> 2015-12-10 1:29 GMT+02:00  <cpaul at redhat.com>:
> > From: Lyude <cpaul at redhat.com>
> >
> > Signed-off-by: Lyude <cpaul at redhat.com>
> > ---
> >  Makefile.am                                        |  1 +
> >  unstable/primary-selection/README                  |  4 +
> >  .../primary-selection-unstable-v1.xml              | 87 ++++++++++++++++++++++
> >  3 files changed, 92 insertions(+)
> >  create mode 100644 unstable/primary-selection/README
> >  create mode 100644 unstable/primary-selection/primary-selection-unstable-v1.xml
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index 5926a41..582a49e 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -5,6 +5,7 @@ unstable_protocols =                                                            \
> >         unstable/text-input/text-input-unstable-v1.xml                          \
> >         unstable/input-method/input-method-unstable-v1.xml                      \
> >         unstable/xdg-shell/xdg-shell-unstable-v5.xml                            \
> > +       unstable/primary-selection/primary-selection-unstable-v1.xml            \
> >         $(NULL)
> >
> >  nobase_dist_pkgdata_DATA =                                                     \
> > diff --git a/unstable/primary-selection/README b/unstable/primary-selection/README
> > new file mode 100644
> > index 0000000..2dfce3d
> > --- /dev/null
> > +++ b/unstable/primary-selection/README
> > @@ -0,0 +1,4 @@
> > +Primary selection protocol
> > +
> > +Maintainers:
> > +Lyude <cpaul at redhat.com>
> > diff --git a/unstable/primary-selection/primary-selection-unstable-v1.xml b/unstable/primary-selection/primary-selection-unstable-v1.xml
> > new file mode 100644
> > index 0000000..f63c675
> > --- /dev/null
> > +++ b/unstable/primary-selection/primary-selection-unstable-v1.xml
> > @@ -0,0 +1,87 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<protocol name="primary_selection">
> > +  <copyright>
> > +    Copyright © 2015 Red Hat
> > +
> > +    Permission is hereby granted, free of charge, to any person obtaining a
> > +    copy of this software and associated documentation files (the "Software"),
> > +    to deal in the Software without restriction, including without limitation
> > +    the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > +    and/or sell copies of the Software, and to permit persons to whom the
> > +    Software is furnished to do so, subject to the following conditions:
> > +
> > +    The above copyright notice and this permission notice (including the next
> > +    paragraph) shall be included in all copies or substantial portions of the
> > +    Software.
> > +
> > +    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > +    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > +    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > +    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > +    DEALINGS IN THE SOFTWARE.
> > +  </copyright>
> > +
> > +  <interface name="zwp_primary_selection_device_manager_v1" version="1">
> > +    <description summary="X primary selection emulation">
> > +      Provides the ability to have a primary selection buffer to match that of
> > +      the X server. This allows users to select bodies of text, and then paste
> > +      them in another buffer without having to do the initial paste.
> > +
> > +      The primary buffer manager is in charge of handling client's requests to
> > +      indicate that text has been selection, along with handling client's access
> > +      to selected text.
> > +    </description>
> > +
> > +    <request name="get_primary_selection_device">
> > +      <description summary="Primary selection device manager">
> > +        Singleton global object that manages the zwp_primary_selection_device_v1
> > +        objects for each wl_seat.
> > +      </description>
> > +      <arg name="id" type="new_id" interface="zwp_primary_selection_device_v1"/>
> > +      <arg name="seat" type="object" interface="wl_seat"/>
> > +    </request>
> > +  </interface>
> > +
> > +  <interface name="zwp_primary_selection_device_v1" version="1">
> > +    <request name="selection_set">  
> 
> set_selection sounds nicer to me than selection_set.
> 
> > +      <description summary="set the primary selection">
> > +        Set the current contents of the primary selection buffer. This clears
> > +        anything which was previously held in the primary selection buffer.
> > +
> > +        This request can only be used while the window is focused.
> > +      </description>
> > +      <arg name="source" type="object" interface="wl_data_source"
> > +        summary="The wl_data_source containing the data to set the contents of the primary selection buffer to"/>
> > +    </request>
> > +
> > +    <event name="selection_changed">
> > +      <description summary="another client changed the contents of the primary selection buffer">
> > +        Sent when another client has changed the contents of the primary
> > +        selection to a client that previously owned the contents of the primary
> > +        selection.
> > +      </description>
> > +    </event>
> > +
> > +    <event name="selection_offer">
> > +      <description summary="primary selection buffer is ready for reading">
> > +        Sent when the client has permission to read from the primary selection
> > +        buffer.
> > +
> > +        This event is sent whenever the client receives a middle click, and will
> > +        be received by the client before the actual middle click event. While
> > +        the compositor is free to bind this event to another input event (such
> > +        as a keyboard shortcut), the client should always treat pastes from the
> > +        primary selection as middle clicks. This is to ensure the behavior is
> > +        identical to that of primary selection pasting in X.
> > +
> > +        It is up to the client to decide whether or not it is appropriate to
> > +        read from the primary buffer and paste it's contents.
> > +      </description>
> > +      <arg name="offer" type="new_id" interface="wl_data_offer"  
> 
> You cannot create new wl_data_offer objects here. Interfaces should
> only have one factory interface, and wl_data_offer has
> wl_data_something already, otherwise you cannot bump the interface
> version anymore. You should create your wp_primary_offer interface or
> something.

Also, it seems all interfaces are missing destructor protocol. For
guidance, see:
http://ppaalanen.blogspot.fi/2014/07/wayland-protocol-design-object-lifespan.html


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151214/4b22a139/attachment.sig>


More information about the wayland-devel mailing list