Re: GTK TreeView control in Windows (DND issue)



On Tue, 13 Sep 2011 11:18:50 +0100, John Emmas wrote:
Thanks Dieter.  I was particularly interested to read that apparently
this did once work.  Also, the fact that it can be made to work after
a fashion by using 'gtk_drag_source_set() / dest_set()' instead of the
official 'gtk_tree_view_enable_model_drag_source() / drag_dest()'.  I
just tried that (in C++) and I can see why someone might think that
but to be honest, I'm not convinced it's the solution.

It's not the solution but was proposed as a workaround until a proper
solution is found.

What I did notice though is that regardless of whether you use
'gtk_tree_view_enable_model_drag_source()' or 'gtk_drag_source_set()'
there's a problem with the context action.  In function
'gtk_drag_button_release_cb()' (gtkdnd.c) there's a section that looks
like this:-

if ((info->context->action != 0) && (info->context->dest_window != NULL))
{
        gtk_drag_end (info, event->time);
        gtk_drag_drop (info, event->time);
}
else
{
gtk_drag_cancel (info, GTK_DRAG_RESULT_NO_TARGET, event->time);
}

Normally, 'info->context->action' would be whatever action you'd set
it to (GDK_ACTION_MOVE / GDK_ACTION_COPY / GDK_ACTION_ASK etc).  But
by the time the code reaches that point the action data seems to have
gotten lost somewhere.  For a TreeView control (in gtk-win32)
'info->context->action' is always zero.   Consequently, the rest of
the process always fails and 'gtk_drag_cancel()' gets called.   This
is what's aborting the drop part and it's true, whichever method you
use to set up the drag source.

I think you're on to something here...

If nobody already knows what's wrong I'll see if I can look into this
and find some more information but it won't be this week.  Probably
early next week with a bit of luck.  I'm amazed that this hasn't been
solved already though. It's been a problem for a very long time.  I'd
be happy to collaborate with one of the devs though, if that would
help speed things along.

Most likely nobody has had the time to look into it. Sadly, there's not
that many people left working on the win32 port, so all the help we
can get is *most welcome*!

I'd be glad to help out where I can with this, especially because the
solution we find for gtk-2.24 might also help gtk-3, where DnD currently
crashes horribly (for example gtk3-demo's "Icon View>Editing and
Drag-and-Drop" demo).

But be aware I'm not an expert on GDK's win32 backend either.

Thanks,
Dieter



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