Hi folks, I'm trying to understand how drag and drop works with when both containers and some of their children accept drags. It seems that if a widget accepts any drags of any type, it blocks drags to parent widgets, even if it doesn't accept that type of data. I've attached a sample program that illustrates this. It has a container that accepts drags of text/uri-list type, and in that container is a GtkColorButton, which has a built-in handler for application/x-color. If you drag a file anywhere not over the color button, you can drop it. But you can't drop if you're over the color button. What I would like is for the color button to completely ignore that drag and let it be handled by the parent container. Is this at all possible? -- Shaun
#include <gtk/gtk.h> enum { DRAG_TYPE_URI_LIST }; static const GtkTargetEntry drag_types[] = { { "text/uri-list", 0, DRAG_TYPE_URI_LIST }, }; static void drag_data_received (GtkWidget *widget, GdkDragContext *context, int x, int y, GtkSelectionData *selection, guint info, guint time, gpointer data) { printf ("%s\n", gtk_selection_data_get_data (selection)); } int main (int argc, char **argv) { GtkWidget *window, *vbox, *label, *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 400, 200); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); vbox = gtk_vbox_new (FALSE, 12); g_object_set (vbox, "border-width", 6, NULL); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_drag_dest_set (vbox, GTK_DEST_DEFAULT_ALL, drag_types, G_N_ELEMENTS (drag_types), GDK_ACTION_COPY); g_signal_connect_after (vbox, "drag-data-received", G_CALLBACK (drag_data_received), NULL); label = gtk_label_new ("Drag a file anywhere on this window."); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); button = gtk_color_button_new (); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show_all (window); gtk_main (); }
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list