astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.04k stars 75 forks source link

ICCCM Compliance: Only respond to selections for the requested target. #94

Open hackerb9 opened 3 years ago

hackerb9 commented 3 years ago

Some programs try to request targets even if we don't advertise them as available in TARGETS. When xclip owns the selection, it is supposed to refuse requests for non-existent targets (using a null property message). Currently, we just send the data we have, willy-nilly, which is definitely the wrong thing to do.

For example, I did xclip -c -t image/jpeg < foo.jpg, then tried pasting an image into this very bug report window using ^V, I ended up with a long string of Unicode gibberish because Firefox had asked xclip for a series of targets: "TARGETS", "text/plain;charset=utf-8", "UTF8_STRING", "COMPOUND_TEXT", "STRING", and finally "text/x-moz-text-internal".