[ENH] Making Squeak use the Unix clipboard properly

Ned Konz ned at bike-nomad.com
Wed Apr 10 21:14:23 UTC 2002


On Wednesday 10 April 2002 01:42 pm, Lex Spoon wrote:
> On Wed, Apr 10, 2002 at 12:51:14PM -0700, Ned Konz wrote:
> > One thing that's bugged me for a while about Squeak is that it
> > uses the PRIMARY buffer for its cut and paste operations. This
> > makes it work differently than KDE, Gnome, Netscape, etc., which
> > all use the CLIPBOARD buffer for explicit copy/cut/paste
> > operations.
> >
> > The attached patch allows you to use the CLIPBOARD (or PRIMARY,
> > depending on a #define).
>
> This looks great, Ned.  Do you know of any documentation to support
> which buffer to use?  For example, do any of the official X docs
> have anything to say?

http://www.freedesktop.org/standards/clipboards.txt quotes the ICCCM.

Qt2 was broken, in that it used PRIMARY for the source of the paste 
operation (and the destination of the copy operation). Which meant 
that you couldn't paste from the clipboard and replace the current 
selection. Which is really annoying. Qt3 fixes this (and is used by 
KDE3).

> More to the point, is CLIPBOARD available everywhere?  If not, the
> autoconf scripts need to set the buffer choice properly (and
> perhaps give the user a way to override the choice.)

Well, my code will create a CLIPBOARD atom if it doesn't exist, so 
it'll be available <g>. However, if nothing else uses it, that won't 
help much.

Actually, I suppose we could do this:

clipboardAtom = XInternAtom(stDisplay, "CLIPBOARD", True) || 
XInternAtom(stDisplay, "PRIMARY", False);

which would get CLIPBOARD if it were already interned or get PRIMARY 
otherwise.

But that won't work entirely, since you could have a mix of apps that 
used one or the other behavior (for instance, Netscape and KDE2).

Another possibility is to have a commandline flag, and/or copy into 
the PRIMARY as well as the CLIPBOARD.

However, when Squeak gets stuff from the clipboard it will have to 
choose between one or the other.

Or we could make a new primitive that would handle a variety of 
clipboard formats and clipboard choices; this would allow us to have 
both a concept of the "current selection" and a clipboard. Probably 
more work than it's worth, though; especially since the text 
selection behavior comes and goes all the time with mouse movements.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list