Note: I am using GDK DND and not GTK.
I am not able to make GDK managed DND work (for X11 backend). The “cancel”, “drop-performed” and “action-changed” signals work, but I do not get a GDK_SELECTION_REQUEST signal.
I am using this way:
GdkDevice *device = gdk_device_manager_get_client_pointer(
gdk_display_get_device_manager(
gdk_display_get_default()));
GdkDragContext *ctx = gdk_drag_begin_for_device(src_window, device, targets);
src_window is a Gdk window for DND (it works on non-managed scenario).
targets is a GList:
*list = g_list_append(*list, TARGET_UTF8_STRING_ATOM);
*list = g_list_append(*list, TARGET_MIME_TEXT_PLAIN_ATOM);
*list = g_list_append(*list, TARGET_STRING_ATOM);
TARGET_UTF8_STRING_ATOM = gdk_atom_intern_static_string("UTF8_STRING");
TARGET_MIME_TEXT_PLAIN_ATOM = gdk_atom_intern_static_string("text/plain");
TARGET_STRING_ATOM = gdk_atom_intern_static_string("STRING");
Then i make it managed:
gdk_drag_context_manage_dnd(ctx, src_window, actions);
actions is GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK
Then i connect the signals:
g_signal_connect(ctx, "cancel",
G_CALLBACK(dnd_cancel_callback), NULL);
g_signal_connect(ctx, "drop-performed",
G_CALLBACK(dnd_drop_performed_callback), NULL);
g_signal_connect(ctx, "action-changed",
G_CALLBACK(dnd_action_changed_callback), NULL);
All signals work, but DND does not perform successfully (no data transfer). I suspect it’s related to the GDK_SELECTION_REQUEST not being fired.
Any hint is appreciated.