Re: Gtk3 and drag'n'drop



On 24 February 2018 at 12:10, Jeff <jffry posteo net> wrote:
I've almost got drag'n'drop working in Gtk3, but I'm just missing the
final piece:

To finish a drag in Gtk2, you call finish() on the context, typically like:

 $context->finish(1, $delete, time);

If I do this in Gtk3, I get:

*** unhandled exception in callback:
***   Can't locate object method "finish" via package
"Glib::Object::_Unregistered::GdkX11DragContext" at ../gtk3_iconview.pl
line 251.
***  ignoring at /usr/share/perl5/Gtk3.pm line 546.

I can't find any docs or examples for dnd and Gtk3 in Perl, but the C
docs describes finish:

https://developer.gnome.org/gtk3/stable/gtk3-Drag-and-Drop.html#gtk-drag-finish

This python example doesn't finish the drag:

https://python-gtk-3-tutorial.readthedocs.io/en/latest/drag_and_drop.html

So - what is the Perl equivalent of gtk_drag_finish()?

The issue is that the GTK drag and drop API lives in the GTK
namespace, but operates on a GdkDragContext object under the GDK
namespace. This is not allowed with introspection-based bindings,
because the method cannot be reconciled with the object.

Of course, this is perfectly valid at the C level, because there are
only functions. Which means that the gtk_drag_* API has to be treated
as functions, e.g.:

  Gtk3::drag_finish($context, $delete, time);

The old Gtk2 bindings would "cheat", and move the API under the
GdkDragContext namespace, hence the change.

Ciao,
 Emmanuele.


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