GNOME Bugzilla – Bug 568263
gtk can't recognize the wrong X Selection TARGETS' type "TARGETS" by java applications
Last modified: 2009-11-11 21:42:46 UTC
Please describe the problem: Try to copy some text from java application, and try to paste in gedit. (Note: gnome-terminal will work, because it try to get text from clipboard, not use X Selection TARGETS' type) "Paste" in this menu list should be selectable, if clipboard data is available. But "Paste" item in this list is gray out then can't paste text from java application. PS: this bug is also reported to SUN. Url:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6584971 Steps to reproduce: 1. Open a java swing application, copy some text from it. 2. Launch gedit 3. Try to use edit menu to paste text. Actual results: Paste menu is gray out. Expected results: Paste menu should be selectable. Does this happen every time? Yes. Other information:
I tried copy from other applications, and using wish (tcl/tk), I get the following results: epico@linux-3h7d:~> wish % selection get -type TARGETS TIMESTAMP TARGETS MULTIPLE UTF8_STRING COMPOUND_TEXT TEXT STRING When I copy from java application, I get the following message, % selection get -type TARGETS 0xf5 0x1ae 0x1f 0x216 0x217 0x218 0x219 0x21a 0x21b 0x21c 0x215 The X Selection TARGETS' type should be ATOM, but java.awt set it as TARGETS, too.
Created attachment 126736 [details] [review] A patch for gtk2 to recognize the wrong selection type by java applications.
* gtk/gtkselection.c (gtk_selection_data_get_targets): Accept a type of TARGETS instead of ATOM, too. Based on a patch by Peng Wu.