Karl DeBisschop wrote: > On my linux installs, I find that cut-and-paste only works within XXE, > there is no connection with cut-and-paste in emacs/X/gnome.
> Is it likely an XXE limitation or something with my JVM, or something X windows has two different mechanisms for cut-and-paste; the primary selection, and the clipboard. There's a really good description of these (and the obsolete cut-buffer mechanism from X 10, which makes 3) at http://www.jwz.org/doc/x-cut-and-paste.html - it explains the differences between the different mechanisms, and between X and Windows/Mac style of cut-and-paste. Java supports primary selections as well as clipboard, but Swing only has built-in support for setting the primary selection in text and table objects, and setting the primary selection for those only appeared in 1.4. In any case, even with Java 1.4.1, the M1.3 XXE appears to use objects that do not set or get the X primary selection. It would be nice if XXE 2 would support X primary selections as well as clipboard; it's quite easy to retrofit - example code looks like this: > /** > * Copy a String to the system selection and possibly to the system > clipboard. > * > * @param s String to copy > * @param wantCopy if true additionally copy to system clipboard. > */ > static final void copyToClipboard(final String s, boolean wantCopy) > { > final Toolkit tk = Toolkit.getDefaultToolkit(); > final Clipboard pri = tk.getSystemSelection(); > final Clipboard cb = tk.getSystemClipboard(); > final StringSelection ss = new StringSelection(s); > > pri.setContents(ss,ss); > > if (wantCopy) > cb.setContents(ss,ss); > } [Looking at the code, the Toolkit and the two Clipboard variables could probably be static, although the method might then need synchronization] This code could be called whenever the current selection was updated (with wantCopy false), or at the very least whenever a cut/copy was performed (with wantCopy true), so that the text placed on the clipboard is also made the primary selection. In the meantime, Karl, you can use tools that support explicit cut-and-paste via the clipboard, instead of the primary selection and middle-button paste. XEmacs has clipboard cut-and-paste on the menu (GNU emacs only supports primary selection and cut-buffers) and many other X apps, though not xterm, also provide menu-based cut-and-paste. The xclipboard X application, and KDE's klipper, can be useful to provide a bridge between the two mechanisms. @alex -- mailto:dupuy at sysd.com

