X11 clipboard vs. selection


Subject: X11 clipboard vs. selection
From: Petr Tesarik (tesarik@lupa.cz)
Date: Tue May 16 2000 - 13:20:41 CDT


Hi folks!

I looked at the X clipboard code. The situation is that:

1. AFAIK most applications use the selection (property PRIMARY). If I
   remember it right, someone working for the GNOME project concluded
   that this is the right solution(TM).

2. There is a thing called the clipboard (property CLIPBOARD). The
   only application I know that uses this property is xclipboard.

3. There is one more method (used by xv): to set a root window
   property "XV_CLIPBOARD" (via XChangeProperty &
   XGetWindowProperty). This is a really nasty one but ted editor
   seems to support it - and xv is rather popular. :O

So, in the worst case there are 3 possible clipboards. AbiWord chose
to get the clipboard #1 for mouse middle-button and clipboard #2 for
Ctrl+V, Edit/Paste and the Paste icon. This is really BAD, folks.

It leads to weird behavior for the "church secretary". It even lead to
unexpected behavior for me until I discovered the existence of two
unrelated clipboards. It may be rather frustrating to see the middle
button pasting something and clicking the icon pasting something
else. The author of ap_UnixApp.cpp suggested to use the most recent
one at user's option. This sounds like a good idea to me, only - if it
should be optionable at all, that suggested behavior should definitely
be the default.

As a matter of fact, there are other interesting issues regarding
clipboarding:

1. Ted uses a target named "RTF" (not "text/rtf" like AbiWord
   does). It contains (surprisingly) pretty nice RTF. It _may_ be
   possible to achieve clipboard compatibility with ted. Do you think
   it's worth it?

2. Emacs uses a special format when using non-Latin1 encodings (it
   prefixes them with "\e-A", "\e-B", etc. sequences). I guess it's
   the correct way to encode ISO 10646 under X. We should be able to
   paste international text from Emacs.

Is anyone working on the X clipboard code right now? Or can I just
start hacking? :)

Cheers,

-- 
Petr Tesarik
Tel: +420 602 575294            http://www.lupa.cz/



This archive was generated by hypermail 2b25 : Tue May 16 2000 - 13:20:45 CDT