Publishing The New Clipboard Specification

Toni Ruottu toni.ruottu at iki.fi
Sat Nov 10 08:58:25 PST 2007


   Hello.

Five months ago I posted a rewrite of the Freedesktop.org
Clipboard Specification to xdg-list. Since related
discussions haven't really brought up any problems and
no-one has resisted the proposal, I have polished the
specification.

It was requested by Havoc Pennington that the old
specification, being some what different, would be
preserved for reading. That is the route I'm following.

I have included a patch for the old clipboards.txt
which adds a note to the beginning of that file
explaining that toolkit developers are advised to
use a more recent version. I've also attached the
polished version of the new clipboard specification.

Someone would need to apply the patch to the CVS version
of clipboards.txt and also add the new clipboard-spec.txt
to the same CVS folder. Web version of the relevant
directory can be accessed at
http://webcvs.freedesktop.org/icccm-extensions/selections/

After this someone would need to update web page at
http://freedesktop.org/wiki/Specifications/clipboards-spec
to point to the new version.

I suppose the Wiki-page at
http://freedesktop.org/wiki/Specifications/ClipboardsWiki
should also be updated.

I don't have the required permissions myself.

  --Toni

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clipboards.txt.patch
Type: text/x-patch
Size: 588 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xdg/attachments/20071110/5eab2f92/attachment.bin 
-------------- next part --------------
November 2007                                                  T. Ruottu

                           Freedesktop.org
                       Clipboard Specification

                                0.9.0

Table of Contents

   0. Terms
   1. Introduction
   2. Scope
   3. Conformance
   4. Attaching Point
   5. Explicit copy/paste
   6. Implicit copy/paste
   7. Restrictions
   8. References and Bibliography
   A. Acknowledgments

0. Terms

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the
   normative parts of this document are to be interpreted as described
   in RFC2119.

1. Introduction

   In colloquial language clipboard refers to an idea of an abstract
   temporary data storage manipulated by copy, paste and cut operations.
   Copy and paste are a set of operations used to transfer data between
   applications. From the users point of view copy creates an infinite
   amount of copies of some selected content and paste attaches a copy
   of the previously copied content to the active application. Cut is a
   short cut for making the copy operation and deleting the selected
   content after copying it first.

2. Scope

   Almost every desktop operating system provides an explicit copy/paste
   feature. In addition many system provide an implicit copy/paste
   feature for advanced users.

   Many legacy systems have differing characteristics. Modern systems
   implement different sets of those characteristics. While most
   differences are small, they result in broken user experiences when
   user switches from one system to other differing systems.

   This specification attempts to define a standard for clipboard
   behavior and provide rationale for the described behavior. The
   specification defines a reasonable default behavior for desktop
   systems. Implementers are encouraged to provide optional behaviors
   for users who feel uncomfortable with the default behavior.

3. Conformance

   To conform to this specification a system MUST provide an explicit
   copy/paste feature for copying data between applications. An implicit
   alternative SHOULD be provided for advanced users. In each case the
   system MUST follow the given restrictions.

   Behaviour regarding cut will not be handled separately, but
   everything that applies to copy applies to cut respectively. However,
   in some cases copy operations do not have sensible cut-equivalents.
   This may happen when the copy operation does not relate to any
   selection or the selected content is read-only. For example, a
   browser might provide "copy URL" option, enabling user to paste URL
   for the web page he is currently reading. In such cases implementing
   cut-functionality is not required.

4. Attaching Point

   When text is being pasted, attaching is done at the point where
   cursor resides in currently active text field. When the text field
   has a selection the selected content gets overwritten by the attached
   content.  Attaching points for more complex data types are out of the
   scope of this specification.

5. Explicit copy/paste

   Explicit copy refers to any user action with copying as its goal.
   This includes selecting "copy" option from a menu, pressing copy
   button on the tool bar, selecting option "copy URL" from a menu in a
   web browser, etc. Explicit paste refers to any user action with
   pasting as its goal.

   A system implementing the explicit copy/paste feature MUST provide a
   CLIPBOARD pointer which points to the application which holds the
   copied data of the latest explicit copy. In this context pointer is
   used as an abstract term not necessarily referring to any specific
   way of pointing.  The application holding the data is the host
   application for the particular copy operation. When a copy action is
   executed the CLIPBOARD pointer is set to point at the host
   application and the host application is made ready for sending data,
   if pasting happens.

   Loosing data when host application closes MAY be prevented by
   creating a clipboard manager application which immediately after a
   copy operation pastes the data to itself and recopies it from there.
   These operations do not have to be visible to a user. Clipboard
   managers are not in the scope of this specification and are described
   elsewhere in greater detail.

6. Implicit copy/paste

   Implicit copy refers to an act where the user either selects some
   text or does any explicit copy-action that results in text being
   copied.  Implicit copying happens even when user does not command the
   system to do so. This, how ever, does not imply that implicit copying
   should not happen when user gives a copy command. Implicit paste
   refers to the ( explicit ) user action reserved for pasting the text
   that was copied earlier with an implicit copy action. A system that
   implements implicit paste SHOULD allow user to execute implicit
   pasting with middle mouse button.

   Implicit paste which is performed on a text field MUST attach the
   pasted text at the current location of the text cursor without moving
   it first.  Selecting the point of attachment on forehand separately
   by moving cursor reduces errors, as the point can be confirmed, even
   altered, before actual pasting takes place. In some applications it
   would also be hard to move the cursor at pasting time. These
   applications include many terminal emulators, for instance.

   An implicit paste which is performed on an element other than a text
   field MAY launch some convenient operation based on the pasted text.
   E.g. a web browser might use this feature for entering a web site
   when the text is an URL or launching a web search when the text is
   something else. Just to give an example. A reasonable behaviour
   depends a lot on application and pasted text, and is out of the scope
   of this specification.

   A system implementing the implicit copy/paste feature MUST have a
   PRIMARY pointer which points to the host application with the latest
   implicit copy action and a SECONDARY pointer which points to the host
   with the preceding implicit copy-action. I.e. SECONDARY stores one
   step of copy history. Implicit paste-action pastes PRIMARY, unless
   data pasted from PRIMARY would be equal to the current selection. In
   such case SECONDARY would be pasted instead. Implementing implicit
   copy/paste this way, should make it possible for two implicitly
   copied items to take turns, enabling user to overwrite the items
   multiple times with each other by simply executing implicit paste on
   the same selection continuously.

7. Restrictions

   A selection becoming unselected MUST NOT have any affect on any of
   the three pointers (CLIPBOARD, PRIMARY, SECONDARY). Altering any of
   the three pointers (CLIPBOARD, PRIMARY, SECONDARY) MUST NOT affect
   any selections. Making a selection in one application MUST NOT affect
   selections in other applications.

   The implicit actions MUST NOT affect nor paste CLIPBOARD. The
   explicit paste commands MUST NOT paste PRIMARY nor SECONDARY.

8. References and Bibliography

   - the ICCCM
   - RFC2119
   - http://www.xfree86.org/~keithp/talks/selection.ps
   - http://www.jwz.org/doc/x-cut-and-paste.html
   - http://www.freedesktop.org/wiki/ClipboardManager
   - Freedesktop.org clipboards.txt (historical)

A. Acknowledgments

   Using SECONDARY to store the old implicit copy for pasting it over a
   selection was proposed by Frisco M. Rose on Freedesktop.org wiki.
   ICCCM specifies similar uses for SECONDARY, but not this particular
   one. 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/xdg/attachments/20071110/5eab2f92/attachment.pgp 


More information about the xdg mailing list