Re: [1.2] Drop on treeitem



Owen Taylor wrote:

I'm unable to make Drag'N'Drop work correctly on GtkTreeItem, my drop
routine works OK if called on a clist or on a tree, but I need to know
exactly on WHICH tree item the drop occurs, so I'm trying to setup my
tree calling gtk_drag_dest_set() for EACH treeitem of the tree. I've
read this should work in the 1.2 tutorial:
You won't be able to get it to work. GtkTree violated several
fundamental constraints of the GTK+ widget system, the one
that matters here is that every child widget must be contained
within the bounds of it's parent widget.

I don't know if what I've done is correct, but I've applied a patch I've
found on the net both to GTK 1.2.10 sources and to WIN32 GTK 1.3.0, the
patch is a small modification to gtktree.c and gtktreeitem.c that move
from the treeitem forall call to the tree forall call the treeitem
redraw callback, in this way I can do drag & drop (with visual highlight
too) on arbitrary treeitems.

I'm asking this because I'm actually using this patched GTK since a pair
of days and I don't see problems of any kind, so I don't understand why
a similar patch was not submitted to the official distribution!

Here is the patch:

diff -p gtk+-1.2.10/gtk/gtktree.c
/home/gabry/projects/gtk+-1.2.10/gtk/gtktree.c
*** gtk+-1.2.10/gtk/gtktree.c   2001-02-26 20:20:07.000000000 +0100
--- /home/gabry/projects/gtk+-1.2.10/gtk/gtktree.c      2003-06-27
11:21:19.000000000 +0200
*************** gtk_tree_forall (GtkContainer *container
*** 541,546 ****
--- 541,550 ----
        children = children->next;

        (* callback) (child, callback_data);
+             // ADDED by GG for DND patch
+       if (include_internals && GTK_TREE_ITEM(child)->subtree)
+           (* callback) (GTK_TREE_ITEM(child)->subtree, callback_data);
+
      }
  }

diff -p gtk+-1.2.10/gtk/gtktreeitem.c
/home/gabry/projects/gtk+-1.2.10/gtk/gtktreeitem.c
*** gtk+-1.2.10/gtk/gtktreeitem.c       2001-02-16 21:55:47.000000000 +0100
--- /home/gabry/projects/gtk+-1.2.10/gtk/gtktreeitem.c  2003-06-27
11:22:02.000000000 +0200
*************** gtk_tree_item_forall (GtkContainer *cont
*** 1112,1117 ****
--- 1112,1120 ----

    if (bin->child)
      (* callback) (bin->child, callback_data);
+ #if 0
+   // removed by GG for DnD patch
    if (include_internals && tree_item->subtree)
      (* callback) (tree_item->subtree, callback_data);
+ #endif
  }








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