Re: GTK TreeView control in Windows (DND issue)



On 13 Sep 2011, at 09:46, dieterv wrote:

> 
> I'm still seeing it on 2.24 and think these bug reports
> are related:
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=641924
> https://bugzilla.gnome.org/show_bug.cgi?id=652235
> 


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.

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.

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.  Regards.

John


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