+static gboolean ql_drag_motion(GtkWidget *w,
+ GdkDragContext *dc,
+ gint x,
+ gint y,
+ guint time_,
+ gpointer user_data) {
+ struct queuelike *const ql = user_data;
+ GdkDragAction action = 0;
+
+ // GTK_DEST_DEFAULT_MOTION vets actions as follows:
+ // 1) if dc->suggested_action is in the gtk_drag_dest_set actions
+ // then dc->suggested_action is taken as the action.
+ // 2) otherwise if dc->actions intersects the gtk_drag_dest_set actions
+ // then the lowest-numbered member of the intersection is chosen.
+ // 3) otherwise no member is chosen and gdk_drag_status() is called
+ // with action=0 to refuse the drop.
+ if(dc->suggested_action) {
+ if(dc->suggested_action & (GDK_ACTION_MOVE|GDK_ACTION_COPY))
+ action = dc->suggested_action;
+ } else if(dc->actions & GDK_ACTION_MOVE)
+ action = GDK_ACTION_MOVE;
+ else if(dc->actions & GDK_ACTION_COPY)
+ action = GDK_ACTION_COPY;
+ /*fprintf(stderr, "suggested %#x actions %#x result %#x\n",
+ dc->suggested_action, dc->actions, action);*/
+ if(action) {
+ // If the action is acceptable then we see if this widget is acceptable
+ if(gtk_drag_dest_find_target(w, dc, NULL) == GDK_NONE)
+ action = 0;
+ }
+ // Report the status
+ //fprintf(stderr, "drag action: %u\n", action);
+ gdk_drag_status(dc, action, time_);
+ if(action) {
+ GtkTreeViewDropPosition pos;
+
+ // Find the drop target
+ GtkTreePath *path = ql_drop_path(w, GTK_TREE_MODEL(ql->store), x, y, &pos);
+ // Highlight drop target
+ gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(w), path, pos);
+ if(path)
+ gtk_tree_path_free(path);
+ }
+ autoscroll_add(GTK_TREE_VIEW(w));
+ return TRUE; /* We are (always) in a drop zone */
+}
+
+/** @brief Called when a drag moves leaves a candidate destination
+ * @param w Destination widget
+ * @param dc Drag context
+ * @param time_ Current time
+ * @param user_data Pointer to queuelike
+ *
+ * This is the handler for the "drag-leave" signal.
+ *
+ * It turns out that we get a drag-leave event when the data is dropped, too
+ * (See _gtk_drag_dest_handle_event). This seems logically consistent and is
+ * convenient too - for instance it's why autoscroll_remove() gets called at
+ * the end of a drag+drop sequence.
+ */
+static void ql_drag_leave(GtkWidget *w,