Subject: HELP WANTED: Tk and DND... long - DN [1]
Petasis George <petasis@iit.demokritos.gr> - 16 Mar 2000 - comp.lang.tcl
Hi all, I am trying to write an extension that will offer an initial DND implementation to tk, under windows and unix. The current status is as follows: Currently, only text transfer is supported and the only action is copy (both of them have to change of course :-)). There is a running implementation for both platforms. The tcl side is exactly the same for both platforms. The types are given with their mime types. Under windows a modified version of the "olednd" extension is used. Under unix, the extension uses the XDND protocol. The protocol itself is implemented through the sample files given at the official protocol page (xdnd.c & xdnd.h). Under windows, everything work as expected. Some sporadic crashes of tk during exiting that the initial olednd package presented are corrected. Under unix (tested under linux RH6.1 & solaris 2.6), the dnd is working very well among different tk applications (or within the same application). The sample tests included with the "olednd" extension work exactly the same under both windows and unix. BUT (there is always a but :-)), there seem to be some problems in communications with other applications. As i don't have in my desktop applications that use that protocol (kde 1.x does not support it, v 2.0 will support it and I have not installed gnome at all...), I downloaded and installed QT 2.1beta2 in my system. QT supports this protocol (up to version 4). I am using the "dragdrop" example program that comes with the distribution. The good news is that from a tk app you can drop an object in a qt application. But you cannot drop from qt to tk. When you try it, the feedback you get from the qt app (shown by the mouse cursor) is that all tk windows do not support dnd. The protocol defines that in order for a source application to see if the target window supports XDND is to see if it has the XdndAware window property. I am using the XChangePropery to add this property to any tk window that is a dnd source or target. And communication between tk apps is working. That means that the property is there, but QT for some reason fails to find it. After examing the toplevel qt windows with xprop, I found out that all of them have the property XdndAware defined, but they were not drop sources (they didn't have any drop types defined). I tried to reproduce this behaviour with tk, but i came to a problem: Seems, that I cannot add this property to toplevel windows. For example, if I make "." a drop target and then run xprop and select the "." window, this window does not have the XdndAware property. But dropping from another tk app works, and thats confusing me. Is there something I have missed? I mean tk toplevel windows are real toplevel windows? Why xprop cannot see the property, while another tk app does? The only explanation I can give is for tk toplevel windows to be inside another "special" window. Other tk apps can see the property, as the examing the window just under the cursor, but xprop doesn't, as it examines only the "parent" window. But according to the man pages this cannot be the case, because it is stated that tk toplevels are children of the root window. Does anyone has any idea what possibly goes wrong? The other thing I wanted to ask, is whether there is a simple way to add the ability to transfer images. If the user wants to drop an image and he gives me the name of a tk image as the data, is there an easy way to get the image data in a known format (i.e. gif)? Any sample code? Thanks, George
Last modified
2000-07-20
2000-07-20
(195.108.246.52)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
