Perhaps yes, but I would like to see that reflected also in the C API.
To say the truth, in re-implementing tkdnd to be more "compatible" with
Tk than tkdnd 1.x series (i.e. to not start its own event loops, but
re-use Tk's loop), I faced many limitations.
The main problems were:
1) Tk_CoordsToWindow() mentioned here.
2) The fact that you cannot pass a timestamp when retrieving the
selection. GTK has no problem with it (i.e. you will get the selection
no matter what the timestamp is), Qt will not return the selection
unless a specific timestamp (as the XDND speciffication states) is used.
The current workaround is to use Tk's selection mechanism if I detect an
in-process drop, and use another implementation:
Register an event handler for SelectionNotify, perform
XConvertSelection() with the proper timestamp, and get the selection.
It mostly works, except with a small delay that is added (which at times
may exceed 10 sec, so you get a timeout). Usually clicking on the Tk
window helps (you get immediately the selection) - I don't know why.
3) The Tk selection is limited, in that it can handle only 8 & 32 bits
in format. No support for 16 bits (i.e. application/x-color).
4) The fact that Tk selection cannot deal with 16 bit data, poses also
difficulties in sending data to other applications: Tk is very good in
sending text, so I have implemented a hybrid scheme: I use tk selection
to send anything that is 8 bits, and XChangeProperty() to send data in
16 bit format (without support for INCR of course).
I miss of course the ability to specify the format (and not "auto-guess"
it from the ATOM), and of course add support for 16 bits. It is easy to
add these to Tk, its a pain to re-implement everything.
5) It is unclear how you can stop Tk from a selection handler.
I register a selection handler for every dnd type. If my type is 8 bits,
everything is fine, I just pass the string to Tk.
(There is a problem also there, as Tk expects strings to be chopped at
bytes, and the script level is very bad in working with bytes - I
convert every string to a list of bytes, get the part I want with
lrange, and convert back the bytes into a string).
But if the format should be 16 bits, and I use my selection
implementation, how can I stop the selection handler for continuing?
According to the manual, I can create an error, but in this case Tk
issues a background error (it is not obvious from the manual that it
should do so). Looking at the code, I saw a "hole" (TCL_OK & TCL_ERROR
are checked explicitly), so I return TCL_BREAK. But nothing is said
about this in the manual, and I don't know in which versions this
workaround works.
George