DtDndProtocol(4) — File Formats
NAME
DtDndProtocol — drag and drop matching and transfer protocols
DESCRIPTION
The drag and drop protocols provide policy for matching and data transfer between the drag initiator and the drop receiver of file names, selected text spans and application-defined structured data formats.
The drag and drop protocols use the standard X11 selection targets, where available, with the addition of several new selection targets where required.
These protocols provide for the transfer of the following types of data:
• File Names
• Selected Text
• Structured Data
PROTOCOL OVERVIEW
Each protocol consists of the following:
Drag and Drop API Protocol
Each protocol described corresponds to a specific DtDndProtocol enumeration.
Export/Import Targets
The Motif drag and drop API provides support for matching of the data transfer protocol between the drag initiator and the various drop receivers. This allows the user to determine readily which drop sites will accept the dragged data.
The drag initiator sets the XmNexportTargets resource of the XmDragContext to the list of target atoms that describe the data being dragged. The drop receiver sets the XmNimportTargets resource of the XmDropSite to the list of target atoms that describe the data that it will accept. The Motif drag and drop subsystem allows drops when the XmNexportTargets and XmNimportTargets have at least one target in common.
Data Transfer Protocol
Once the drag initiator has dropped on the drop receiver, the transfer of data is begun. The transfer is accomplished using X selections and is controlled by the drop receiver.
The drop receiver starts all transfers by converting the ICCCM TARGETS target to get the set of available selection targets. It then chooses the appropriate selections from that set and requests that the drag initiator convert each requested selection. Each protocol has a set of selection targets that are used to transfer all the necessary data. These target conversions are usually initiated by calling XmDropTransferStart().
Move Completion
When the operation of the drop is XmDROP_MOVE, the drop receiver must complete the move using an appropriate method. For most data transfers, this is accomplished by converting the ICCCM DELETE target to tell the drag initiator that it may delete the data. For most file name transfers, this is accomplished via the file system.
FILE NAME TRANSFER PROTOCOL
The transfer protocol is used to exchange file names.
Drag and Drop API
This is the protocol used when a DtDndProtocol of DtDND_FILENAME_TRANSFER is specified.
Export/Import Targets
The export or import targets are FILE_NAME and, optionally, _DT_NET_FILE if capable of providing the file name in network canonical form using tt_file_netfile(3) and tt_netfile_file(3).
Data Transfer Protocol
If the ICCCM HOST_NAME target is in the list of target atoms, it is converted. If the returned host name is different than the host name for the drop receiver and the _DT_NETFILE target is in the list of target atoms, it is converted. The drag initiator uses tt_file_netfile(3) to encode the file names and the drop receiver uses tt_netfile_file(3) to decode the file names.
If the hosts are the same for both the drag initiator and the drop receiver or either the HOST_NAME or the _DT_NETFILE targets are not in the list of target atoms from the drag initiator, the drop receiver converts the ICCCM FILE_NAME target. No encoding of the file names occurs in this case.
Move Completion
Moves of file names can be accomplished atomically using standard file system operations. Drop receivers are encouraged to use the file system. The drop receiver may alternately choose to use the ICCCM DELETE target to complete the XmDROP_MOVE and the drag initiator must be ready to comply.
STRUCTURED DATA FORMAT TRANSFER PROTOCOL
The transfer protocol is used to exchange structured data in an application-defined format.
Drag and Drop API
This is the protocol used when a DtDndProtocol of DtDND_DATA_TRANSFER is specified.
Export/Import Targets
The export and import targets are application defined. These can be any target that describes the format of the data.
The _DT_UNTYPED target is used to support drop receivers that are able to accept any data format. The drop receiver that is able to accept any data format would include _DT_UNTYPED in the import targets along with any other desired targets. The drag initiator always includes the _DT_UNTYPED target in its export targets along with format specific targets.
Data Transfer Protocol
The drop receiver would choose the most desired target from the available targets and convert it to get the data being dragged.
If the drop receiver will accept any data formats and the _DT_UNTYPED target is in the list of target atoms, it is converted to get the data in the format chosen by the drag initiator.
If the _DT_DATA_LABEL target is in the list of target atoms, it is converted to get a label that can be presented to the user.
Move Completion
The move is completed by converting the ICCCM DELETE target.
TEXT TRANSFER PROTOCOL
The text transfer protocol is used to exchange text selections.
Drag and Drop API
This is the protocol used when a DtDndProtocol of DtDND_TEXT_TRANSFER is specified.
Export/Import Targets
The export or import targets are any of the following; the target describing the character encoding of the text selection, COMPOUND_TEXT, STRING or TEXT.
Data Transfer Protocol
The transfer of text selections follows the protocols described in the ICCCM manual. If the character encoding of the drag initiator and drop receiver are the same, that target should be converted to get the text selection. If the character encoding are different, the drop receiver should attempt to convert the standard text targets in the following order: COMPOUND_TEXT, STRING or TEXT.
Move Completion
The move is completed by converting the ICCCM DELETE target.
SELECTION TARGETS
The following table describes the selection targets used in the drag and drop data matching and transfer protocols.
| Atom | Type | Description |
| TARGETS | ATOM | A list of valid target atoms. See ICCCM section 2.6.2. |
| DELETE | NULL | Used to delete the dropped data. If the drop receiver wishes to perform a move operation on the data, after copying the data it should request conversion of the DELETE target. See ICCCM section 2.6.3.1. |
| COMPOUND_TEXT | COMPOUND_TEXT | The text selection in compound text format. See ICCCM section 2.7.1. |
| STRING | STRING | The text selection in ISO Latin-1 format. See ICCCM section 2.7.1. |
| TEXT | TEXT | The text selection in the format preferred by the selection holder. See ICCCM section 2.7.1. |
| HOST_NAME | TEXT | The name of the machine running the client as seen from the machine running the server. See ICCCM section 2.6.2. |
| FILE_NAME | TEXT | The full path name of the files. See ICCCM section 2.6.2. |
| _DT_NETFILE | TEXT | The full pathname of the files, each encoded using tt_file_netfile(3) and decoded using tt_netfile_file(3). |
| _DT_UNTYPED | TEXT | The data in the owner’s choice of formats. This provides the polymorphism of the TEXT target for data that is not text. |
| _DT_DATA_LABEL | TEXT | The label or name of the data suitable for presentation to the user. |
SEE ALSO
DtDnd(5), DtDndDragStart(3), DtDndVaDragStart(3), DtDndVaDropRegister(3), DtDndDropUnregister(3), DtDropTransferStart(3), XmDragContext(3), XmDragStart(3), XmDropRegister(3), XmDropSite(3), tt_file_netfile(3), tt_netfile_file(3), X11/R5 Inter-Client Communications Conventions Manual (ICCCM)
— 17 June 1994