Alexander Dupuy wrote:
> 
> 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);
> >   }

Thanks for the detailed reply to Karl DeBisschop.

I didn't know that Java now supports X primary selections. We'll see
what we can do in this area...

Reply via email to