Re: Missing drag'n'drop methods in GtkTreeView



Torsten Schoenfeld said:
[1] I'm not sure if I got the stack thingies (EXTEND, PUSHs) right.
    Please check it.

you did it right, but there's an easier way:

void gtk_tree_widget_to_tree_coords (GtkTreeView * tree_view, gint wx, gint
wy, OUTLIST gint tx, OUTLIST ty)

does what your hand-written XS does with a lot less typing.  this is one of
the nifty features new to xsubpp in 5.8.0...


[2] I'm not sure if newSVGtkTreePath or _copy or _own should be used
    since I simply don't know the difference.

_copy should be used when returning an object that you are not allowed to
modify.  _own should be used when returning an object that you are supposed to
free.  if you use _copy where you should use _own, you get a leak.  if you use
_own where you should use nothing, then you destroy something that's not
yours.

i haven't looked yet into which one is correct where.


I failed implementing gtk_tree_view_get_search_equal_func due to a
"missing" entry in the typemap (GtkTreeViewSearchEqualFunc). I can't
tell whether it's /really/ missing or I simply did something wrong.

it's a function pointer, and we are using some grey magic on function
pointers, so this is not surprising.  there is, indeed, no typemap for a
function pointer.

we can't just return the value from get_search_equal_func, because it may not
be ours!  in general, we would check that the installed function is our custom
marshaller and if so return the code reference inside the callback....
however, get_search_equal_func gives us no way to get to the user data
associated with the callback.  to support this, we'll have to store another
copy of the callback someplace, which now gives us the opportunity to get out
of sync and thus cause bugs and memory leaks.

that sucks.  this is why the callback stuff is a bit of grey magic.  (not
black, because it is documented, but not white because there are inevitably
sticky issues like this.)

-- 
muppet <scott at asofyet dot org>



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