I use rdesktop under Linux to connect to a Windows machine. When using rdesktop with -5 -r clipboard:PRIMARYCLIPBOARD, copy/paste does not work from Java/Swing programs on the Linux machine to applications on the remote windows machine.
I tracked the problem down and found that
- the java program does not provide the TIMESTAMP content type
- rdesktop uses the TIMESTAMP to choose between the PRIMARY and the CLIPBOARD selection. (in xclip.c)
(rdesktop 1.7, Java 1.6)
Below is a small Java program for reproducing the bug:
import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class Main2 { public static void main(String[] args) { JFrame frame=new JFrame("Clipboard Test"); JButton button=new JButton("Paste"); frame.add(button); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { StringSelection selection=new StringSelection("foo"); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); } }
There is a patch from David Fries:
https://sourceforge.net/p/rdesktop/patches/192/
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584686
Perhaps this could help.