Gdk Drag-and-Drop - How to use managed DND?

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(

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);


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.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.