drag and drop in gnome



Hello all,
    I'm trying to implement a sample program that accepts drag-n-drop,
however I'm having a serios amount of difficulty in getting it to work.
I'm working from the xDND specification page and the gtk source, but
haven't gotten anywhere, really.  Questions include:
1)  Xdnd requires an atom XdndAware be set on the window receiving the
drop.  The only reference to this atom begin set in the source is in
gdk_window_register_dnd, but this function takes a GdkWindow *, not a
GtkObject.  Attempting to call this function with a GtkObject *
understandably cores.
2)  I attached all the dnd signals I could find to see if I could figure
out what was going on, however none of them were ever called.  I found
that by calling:

gtk_drag_dest_set(edit_control,GTK_DEST_DEFAULT_DROP, targets,2,
   GDK_ACTION_LINK);
I could get the drag-leave signal, but no drag-enter or any of the
others (this is done by dragging a file form gmc over the control).
3)  The format of the GdkDragContext structure is still a little
confusing to me.  Does the targets GList * point to a list of
GtkTargetEntry's?  Since GLIst always eventually resolves to a void *,
how do I tell what is in this list?

What I kind of expected to happen:
1)  There would be some function to enable dnd for a particular window.
2)  You use dest_set to define what kinds of targets this window
accepts.
3)  You attach the appropriate signal handlers.
4)  When an item is drug (dragged?) over and dropped, one of these
signals gets called and you handle the drop

>From my reading I've gotten the impression that the GdkDragContext only
has 3 targets in it and you need to call one of the get functions to get
any more drop types.  However, since I'm only getting the drag-leave
signal, and I don't know what's in the target list, I can't even print
out what the gmc is trying to drop.

Am I barking up the wrong tree here?  Should I be using event handlers
in gdk instead?  Anyone have some example source to get me started?  I
was hoping the source would document some of the flags better too.....

Any help appreciated,
    daniel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]