GTK Drag and Drop object reference in Perl


I've searched many forums for an answer to this but keep coming up empty,
hope someone can help!

I'm using GTK-Perl and wish to pass a GTK widget (or a reference) as the
data in an inter-program drag and drop operation.
Unfortunately both the reference (\$widget) and the object itself are
translated to a string when I call the (Perl wrapped) function
gtk_select_data_set.  I've checked the source for gtk/GtkPerl and there
appears to be an explicit cast to guchar* which I guess instructs Perl to
pass a string formatted version of the $widget (or reference).

My code so far:

        $button2->signal_connect ("drag_data_get", \&fetchDragWidget,$_[1]);
#Attach signal and pass the widget as first parameter.
        sub fetchDragWidget
                my ($widget, $source, $context,$data, $info, $time) = @_;
                my $ref=\$source;

                $data->set ($data->target, 32,$source);
                #$data->set ($data->target, 32,$ref);
#Tried as an alternative


If debugged, at the breakpoint, a "x $data->data" produces :
        0       'Gtk::Table=HASH(0x2c1948)'

Which is clearly a string, a similar result is obtained if the alternative
reference is passed as the data instead (generates a SCALAR).

Does anyone know how to get round this?  I guess my real question is how to
instruct Perl to pickup the reference from a numerical value (which I could
extract from the string).

I currently have a workaround which uses a global variable but I really want
to avoid this if at all possible.  As I said, i've searched loads of forums
and the closest I found was a code fragment in c++ which passed a pointer to
a data structure so I assume it can be done in c++, this suggests this might
be a problem with the bindings???

Thanks, any ideas would be appreciated!


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