Hey Jonas, On Mon, Feb 22, 2016 at 8:53 AM, Jonas Ådahl <jad...@gmail.com> wrote: > On Sat, Feb 20, 2016 at 01:31:59AM +0100, Carlos Garnacho wrote: >> From: Lyude <cp...@redhat.com> >> >> This primary selection is similar in spirit to the eponimous >> in X11, allowing a quick "select text + middle click" shortcut >> to copying and pasting. >> >> It's otherwise very similar to it wayland counterpart, and >> explicitly made consistent with it. >> >> Signed-off-by: Lyude <cp...@redhat.com> >> Signed-off-by: Carlos Garnacho <carl...@gnome.org> >> --- >> After having talked with Lyude, I'll be trying to move this ahead. >> >> Changes since v3: >> - Added a rather verbose protocol description, including a >> high-level overview of the workings. >> - Made event emission 1:1 with wayland core protocol selections, >> wp_primary_selection_offer.offer events are now expected to be >> emitted between wp_primary_data_device.data_offer and >> wp_primary_data_device.selection >> - Improved wording here and there. >> - Added serial argument to wp_primary_data_offer.receive that can be >> used to match against recent events. > > > Overall good. Some comments inline. With those fixed, this is > Reviewed-by: Jonas Ådahl <jad...@gmail.com>
Thanks for the review! > >> >> >> Makefile.am | 1 + >> unstable/primary-selection/README | 4 + >> .../primary-selection-unstable-v1.xml | 229 >> +++++++++++++++++++++ >> 3 files changed, 234 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 57d0023..eefa20f 100644 >> --- a/Makefile.am >> +++ b/Makefile.am >> @@ -7,6 +7,7 @@ unstable_protocols = >> \ >> unstable/xdg-shell/xdg-shell-unstable-v5.xml >> \ >> unstable/relative-pointer/relative-pointer-unstable-v1.xml >> \ >> unstable/pointer-constraints/pointer-constraints-unstable-v1.xml >> \ >> + unstable/primary-selection/primary-selection-unstable-v1.xml >> \ >> $(NULL) >> >> stable_protocols = >> \ >> diff --git a/unstable/primary-selection/README >> b/unstable/primary-selection/README >> new file mode 100644 >> index 0000000..6d8c0c6 >> --- /dev/null >> +++ b/unstable/primary-selection/README >> @@ -0,0 +1,4 @@ >> +Primary selection protocol >> + >> +Maintainers: >> +Lyude <cpaul at redhat.com> > > Any reason for the "anti-spam" thing here? The E-mail address is already > available all over the place anyway (commit author, commit body). > >> 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..a3618d5 >> --- /dev/null >> +++ b/unstable/primary-selection/primary-selection-unstable-v1.xml >> @@ -0,0 +1,229 @@ >> +<?xml version="1.0" encoding="UTF-8"?> >> +<protocol name="primary_selection_unstable_v1"> >> + <copyright> >> + Copyright © 2015 Red Hat > > 2016 now as well? > >> + >> + 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> >> + >> + <description summary="Primary selection protocol"> >> + This protocol provides the ability to have a primary selection device to >> + match that of the X server. This primary selection is a shortcut to the >> + common clipboard selection, where text just needs to be selected in >> order >> + to allow copying it elsewhere. The de facto way to perform this action >> + is the middle mouse button, although it is not limited to this one. >> + >> + Clients wishing to honor primary selection should create a primary >> + selection source and set it as the selection through >> + wp_primary_selection_device.set_selection whenever the text selection >> + changes. In order to minimize calls in pointer-driven text selection, >> + it should happen only once after the operation finished. Similarly, >> + a NULL source should be set when text is unselected. > > Does this mean that a client may not create one source object, and just > keep the same as text is selected, while only setting a NULL source if > text was unselected? Right, that may be a possibility, actually a client choice. I guess it depends on what do we want the wp_primary_selection_device.selection event to mean, whether it just conveys ownership, or whether it really signals that the selection content changed. This is certainly easier in the core protocol since both meanings match to some extent. I'm also struggling to think usecases where the offered mimetypes might change during selection, but I don't think that's too likely. Eg. a rich text widget wants to offer plain text amongst others, despite the user selecting text+images there. That said, at least in gtk+ this is a choice of the widget. I'm folding in your other suggestions, and am thinking in ways to improve the wording here. I'm actually ok with the .selection event conveying only ownership. AFAICT such behavior could only break clipboard managers, which we don't contemplate anyway. Cheers, Carlos _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel