Clipboard for the dummies

Havoc Pennington hp at redhat.com
Fri Nov 1 16:57:27 GMT 2002


Lubos Lunak <l.lunak at suse.cz> writes:
>  The most in-the-spirit-of-X11 way, which Gtk, xedit use, is like this: 
> Selection is selected text, and selected text is selection (the ONLY 
> selection). Which means:
> - selected text, no matter how selected, will be pasted by MMB
> - if there's nothing selected, MMB won't do anything

BTW I think it's harmless to the basic X11 model to change this so
that you always paste the last thing you highlighted. But if something
new is highlighted, it would always need to be pasted, and if
something won't be pasted, it can't be highlighted. That is, if you
can see a highlighted selection, MMB really really has to paste
it. *cough* Mozilla *cough* ;-)

> - only text selected by the mouse becomes the selection (i.e. not text 
> selected by keyboard, or autoselected lineedits)

Special-casing mouse selection seems questionable to me. Especially in
light of accessibility concerns, when you remember that some users
will only use the keyboard, or will use the keyboard primarily.

> - when there's no selected text, selection is still remembered (the last valid 
> selection) - this is why Qt lineedits unselect on focus out, while Gtk ones 
> don't

This is fine I think.

> - explicit actions like 'copy link location' set selection, even if there's no 
> text selected (I couldn't find any such action in any Gtk2 app to test, 
> Havoc?)

Maybe Galeon2 has it, I don't know. As I said earlier, one idea here
is to actually *draw* the highlight for the URL, i.e. it would become
selected in a user-visible way when you choose this menu item.

> Remember, it would be nice if we did it the same way like others do, so we'd 
> have to make at least Qt and Gtk work the same, in case we don't go with the 
> X11-pure style (Havoc: any chance?).

There's certainly some chance. I would expect Owen to be fairly hard
to convince that we should break the current X11 specs in a
backward-incompatible way, but then you may well get supporting
opinions from say the GNOME UI team. Also, GTK should certainly work
like Windows when running on Windows, and I'm not sure it does right
now, so it would make sense to have GTK at least optionally able to
work like Windows.

The important thing I think is to avoid making a unilateral decision
here, since while either the current X11 specs or a new more
Windows-like setup work fine if applied consistently, they are both 
pretty broken if half the apps do one and half the other. ;-)
Users just complained *so much* about the situation in the past that I
hate to recreate it.

If we go to a Windows-like setup, it seems to me that we basically
have to break the MMB paste. You can imagine the flames this will
inspire. While we can say "the last selection you made gets pasted by
MMB" my feeling is that if you can typically see several highlighted
selections on the screen, MMB becomes pretty hard to use.

On the implementation side what Windows-style means is that we would
probably have an X selection for each toplevel window. Maybe it could
be called PRIMARY_<WindowID>. Considering the possibility of
out-of-process components (and XEMBED), it should really be done via
an externally-visible X selection rather than all in-toolkit
in-process.


The summary decision to be made I think:

 - if we continue to conform to current X11 specs, that's certainly 
   easier. Most toolkits/apps are already close to conforming, 
   and people that have researched the issue already understand how 
   it's supposed to work. However, we get the funny global selection.

 - if we go Windows-style, we get per-window selection, but most apps
   are currently broken: Motif apps, Windows, GTK, XEmacs, almost
   everything.  We would have to make a backward-incompatible spec
   change and then convince the world that it was a good idea (after
   we've already been trying to convince them for a while to do it the
   traditional X11 way). Also, MMB paste becomes near-useless.

Essentially, is moving to Windows-style selection important enough to
endure a few years of transition period and quite a few flamewars?
That's the question in my mind.

Havoc



More information about the kde-core-devel mailing list