else {
newTargets = (Atom *) XtMalloc
(sizeof (Atom) * (numExportTargets + 2));
for (m = 0; m < numExportTargets; m++)
newTargets[m] = exportTargets[m];
newTargets[m] = FILE_CONTENTS;
newTargets[m+1] = FILE_NAME;
XtSetArg (args[n], XmNexportTargets, newTargets); n++;
XtSetArg (args[n], XmNnumExportTargets, numExportTargets + 2); n++;
}
/* modify other DragContext resources */
XtSetArg (args[n], XmNblendModel, XmBLEND_JUST_SOURCE); n++;
XtSetArg (args[n], XmNcursorBackground, bg); n++;
XtSetArg (args[n], XmNcursorForeground, fg); n++;
XtSetArg (args[n], XmNsourceCursorIcon, drag_icon); n++;
XtSetArg (args[n], XmNdragOperations, XmDROP_COPY); n++;
XtSetArg (args[n], XmNconvertProc, NewConvertProc); n++;
XtSetArg (args[n], XmNclientData, widget); n++;
XtSetValues (dc, args, n);
XtAddCallback (dc, XmNdragDropFinishCallback, DragDropFinish, NULL);
}
This routine performs many of the same tasks as the StartDrag() action routine, such as accessing the appropriate
structure in the files array and creating a DragIcon for the source icon. The main difference is that we use
XmGetDragContext() to retrieve the current DragContext object, rather than creating one using
XmStartDrag().
The routine retrieves the values of the XmN-exportTargets, XmN-numExportTargets, and
XmN-convertProc resources using XtGetValues() so that it can preserve the existing functionality. The
appropriate new targets are added to the list of targets based on the type of the file, and XmN-exportTargets is set
to the new list. ...