XMDRAGCONTEXT(3)
π NAME π
XmDragContext β The DragContext widget class, no cap. π
β¨ SYNOPSIS β¨
#include <Xm/DragDrop.h>
πΈ DESCRIPTION πΈ
Okay so bestie, DragContexts are these special widgets used in drag and drop transactions. π¦ A DragContext is implemented as a widget, but here's the tea: a client does not explicitly create a DragContext widget. Instead, a client initiates a drag and drop transaction by calling XmDragStart, and this routine initializes and returns a DragContext widget. There is a unique DragContext for each drag operation. The toolkit frees a DragContext when a transaction is complete; therefore, an application programmer should not explicitly destroy a DragContext. Like, don't even think about it. π
Initiator and receiver clients both use DragContexts to track the state of a transaction. When the initiator and receiver of a transaction are in the same client, they share the same DragContext instance. If they are in different clients, there are two separate DragContexts. In this case, the initiator calls XmDragStart and the toolkit provides a DragContext for the receiver client. The only resources pertinent to the receiver are XmNexportTargets and XmNnumExportTargets. These can both be passed as arguments to the XmDropSiteRetrieve function to obtain information about the current drop site. Slay. β¨
In general, in order to receive data, a drop site must share at least one target type and operation in common with a drag source. The DragContext resource, XmNexportTargets, identifies the selection targets for the drag source. These export targets are compared with the XmNimportTargets resource list specified by a drop site. The DragContext resource, XmNdragOperations, identifies the valid operations that can be applied to the source data by the initiator. The drop site counterpart resource is XmNdropSiteOperations, which indicates a drop site's supported operations. Vibe check: they gotta match. π
A client uses DragIcon widgets to define the drag-over animation effects associated with a given drag and drop transaction. An initiator specifies a set of drag icons, selects a blending model, and sets foreground and background cursor colors with DragContext resources. It's giving aesthetic. π
The type of drag-over visual used to represent a drag operation depends on the drag protocol style. In preregister mode, the server is grabbed, and either a cursor or a pixmap may be used as a drag-over visual. In dynamic mode, drag-over visuals must be implemented with the X cursor. If the resulting drag protocol style is Drop Only or None and the XmNdragInitiatorProtocolStyle is XmDRAG_DYNAMIC or XmDRAG_PREFER_DYNAMIC, then a dynamic visual style (cursor) is used. Otherwise, a preregister visual style is used. Iconic. π
π Classes π
DragContext inherits behavior and resources from Core.
The class pointer is xmDragContextClass.
The class name is XmDragContext.
π§ New Resources π§
The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).
okay bestie, so every single one of these has the same five lil facts attached to it: the resource name, its class, its type, its default, and its access code. Read them like a little recipe card π
XmNblendModelβ class:XmCBlendModelΒ· type:unsigned charΒ· default:XmBLEND_ALLΒ· access:CGXmNclientDataβ class:XmCClientDataΒ· type:XtPointerΒ· default:NULLΒ· access:CSGXmNconvertProcβ class:XmCConvertProcΒ· type:XtConvertSelectionIncrProcΒ· default:NULLΒ· access:CSGXmNcursorBackgroundβ class:XmCCursorBackgroundΒ· type:PixelΒ· default:dynamicΒ· access:CSGXmNcursorForegroundβ class:XmCCursorForegroundΒ· type:PixelΒ· default:dynamicΒ· access:CSGXmNdragDropFinishCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CSGXmNdragMotionCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNdragOperationsβ class:XmCDragOperationsΒ· type:unsigned charΒ· default:XmDROP_COPY | XmDROP_MOVEΒ· access:CXmNdropFinishCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNdropSiteEnterCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNdropSiteLeaveCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNdropStartCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNexportTargetsβ class:XmCExportTargetsΒ· type:Atom *Β· default:NULLΒ· access:CSGXmNincrementalβ class:XmCIncrementalΒ· type:BooleanΒ· default:FalseΒ· access:CSGXmNinvalidCursorForegroundβ class:XmCCursorForegroundΒ· type:PixelΒ· default:dynamicΒ· access:CSGXmNnoneCursorForegroundβ class:XmCCursorForegroundΒ· type:PixelΒ· default:dynamicΒ· access:CSGXmNnumExportTargetsβ class:XmCNumExportTargetsΒ· type:CardinalΒ· default:0Β· access:CSGXmNoperationChangedCallbackβ class:XmCCallbackΒ· type:XtCallbackListΒ· default:NULLΒ· access:CXmNoperationCursorIconβ class:XmCOperationCursorIconΒ· type:WidgetΒ· default:dynamicΒ· access:CSGXmNsourceCursorIconβ class:XmCSourceCursorIconΒ· type:WidgetΒ· default:dynamicΒ· access:CSGXmNsourcePixmapIconβ class:XmCSourcePixmapIconΒ· type:WidgetΒ· default:dynamicΒ· access:CSG
quick vibe check on the deets β¨
- the
XmCCallbackgirlies are allXtCallbackListtype, defaulting toNULL, and there's a whole little clique of them:XmNdragDropFinishCallback,XmNdragMotionCallback,XmNdropFinishCallback,XmNdropSiteEnterCallback,XmNdropSiteLeaveCallback,XmNdropStartCallback,XmNoperationChangedCallbackπ«Ά - the icon trio β
XmNoperationCursorIcon,XmNsourceCursorIcon,XmNsourcePixmapIconβ are allWidgettyped withdynamicdefaults, lowkey iconic π dynamicdefaults show up a lot:XmNcursorBackground,XmNcursorForeground,XmNinvalidCursorForeground,XmNnoneCursorForeground, plus the icons andXmNoperationCursorIconπ¦- watch the access codes fr fr, they're not all the same: some are
CSGand some are justCβ no cap, they differ per resource π
not me pointing out thatXmNinvalidCursorForegroundandXmNnoneCursorForegroundshare the classXmCCursorForegroundwithXmNcursorForegroundβ same class, three different names, it's giving family reunion π
XmNstateCursorIconβ classXmCStateCursorIcon, typeWidget, default dynamic, accessCSGXmNtopLevelEnterCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNtopLevelLeaveCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNvalidCursorForegroundβ classXmCCursorForeground, typePixel, default dynamic, accessCSG
XmNblendModel
okay bestie this one decides which combo of DragIcons get blended together to make that drag-over visual you see while you're dragging. it's giving "choose your fighter":
XmBLEND_ALLβ blends all three DragIcons: the source, state and operation icons. they're layered top to bottom with the operation icon on top and the source icon on the bottom. the hotspot is derived from the state icon. πXmBLEND_STATE_SOURCEβ blends the state and source icons only. the hotspot is derived from the state icon.XmBLEND_JUST_SOURCEβ specifies that only the source icon is used, which the initiator updates as required.XmBLEND_NONEβ specifies that no drag-over visual is generated. the client tracks the drop site status through callback routines and updates the drag-over visuals as necessary.
XmNclientData
Specifies the client data to be passed to XmNconvertProc when it is invoked.
XmNconvertProc
If XmNincremental is True, specifies a procedure of type XtConvertSelectionIncrProc that converts the source data to the format(s) requested by the receiver client. the widget argument passed to this procedure is the DragContext widget. the selection atom passed is _MOTIF_DROP. if XmNincremental is False, the procedure is an XtConvertSelectionProc, and should ignore the max_length, client_data, and request_id arguments and should handle the conversion atomically. data returned by XmNconvertProc must be allocated using XtMalloc, and will be freed automatically by the toolkit after the transfer. for additional info on selection conversion procedures, see X Toolkit IntrinsicsβC Language Interface. π«Ά
XmNcursorBackground
Specifies the background pixel value of the cursor.
XmNcursorForeground
Specifies the foreground pixel value of the cursor when the state icon is not blended. this resource defaults to the foreground color of the widget passed to the XmDragStart function.
XmNdragDropFinishCallback
Specifies the list of callbacks that are called when the transaction is completed. the type of the structure whose address is passed to this callback is XmDragDropFinishCallbackStruct. the reason sent by the callback is XmCR_DRAG_DROP_FINISH.
XmNdragMotionCallback
Specifies the list of callbacks that are invoked when the pointer moves. the type of structure whose address is passed to this callback is XmDragMotionCallbackStruct. the reason sent by the callback is XmCR_DRAG_MOTION.
XmNdragOperations
Specifies the set of valid operations associated with an initiator client for a drag transaction. this resource is a bit mask that is formed by combining one or more of the following values using a bitwise operation such as inclusive OR (|):
XmDROP_COPYXmDROP_LINKXmDROP_MOVE
The value XmDROP_NOOP for this resource indicates that no operations are valid. for Text and TextField widgets, this resource is set to XmDROP_COPY | XmDROP_MOVE; for List widgets, it is set to XmDROP_COPY. β¨
XmNdropFinishCallback
Specifies the list of callbacks that are invoked when the drop is completed. the type of the structure whose address is passed to this callback is XmDropFinishCallbackStruct. the reason sent by the callback is XmCR_DROP_FINISH.
XmNdropSiteEnterCallback
Specifies the list of callbacks that are invoked when the pointer enters a drop site. the type of the structure whose address is passed to this callback is XmDropSiteEnterCallbackStruct. the reason sent by the callback is XmCR_DROP_SITE_ENTER.
XmNdropSiteLeaveCallback
Specifies the list of callbacks that are invoked when the pointer leaves a drop site. the type of the structure whose address is passed to this callback is XmDropSiteLeaveCallbackStruct. the reason sent by the callback is XmCR_DROP_SITE_LEAVE.
XmNdropStartCallback
Specifies the list of callbacks that are invoked when a drop is initiated. the type of the structure whose address is passed to this callback is XmDropStartCallbackStruct. the reason sent by the callback is XmCR_DROP_START.
XmNexportTargets
Specifies the list of target atoms associated with this source. this resource identifies the selection targets this source can be converted to.
XmNincremental
Specifies a Boolean value that indicates whether the transfer on the initiator side uses the Xt incremental selection transfer mechanism described in X Toolkit IntrinsicsβC Language Interface. if the value is True, the initiator uses incremental transfer; if the value is False, the initiator uses atomic transfer. π¦
XmNinvalidCursorForeground
Specifies the foreground pixel value of the cursor when the state is invalid. this resource defaults to the value of the XmNcursorForeground resource.
XmNnoneCursorForeground
Specifies the foreground pixel value of the cursor when the state is none. this resource defaults to the value of the XmNcursorForeground resource.
XmNnumExportTargets
Specifies the number of entries in the list of export targets.
XmNoperationChangedCallback
Specifies the list of callbacks that are invoked when the drag is started and when the user requests that a different operation be applied to the drop. the type of the structure whose address is passed to this callback is XmOperationChangedCallbackStruct. the reason sent by the callback is XmCR_OPERATION_CHANGED.
XmNoperationCursorIcon
Specifies the cursor icon used to designate the type of operation performed by the drag transaction. if NULL, XmScreen resources provide default icons for copy, link, and move operations.
XmNsourceCursorIcon
Specifies the cursor icon used to represent the source when a dynamic visual style is used. if NULL, the XmNdefaultSourceCursorIcon resource of XmScreen provides a default cursor icon.
XmNsourcePixmapIcon
Specifies the pixmap icon used to represent the source when a preregister visual style is used. the icon is used in conjunction with the colormap of the widget passed to XmDragStart. if NULL, XmNsourceCursorIcon is used.
XmNstateCursorIcon
Specifies the cursor icon used to designate the state of a drop site. if NULL, XmScreen resources provide default icons for a valid, invalid, and no drop site condition. π
XmNtopLevelEnterCallback
Specifies the list of callbacks that are called when the pointer enters a top-level window or root window (due to changing screens). the type of the structure whose address is passed to this callback is XmTopLevelEnterCallbackStruct. the reason sent by the callback is XmCR_TOP_LEVEL_ENTER.
XmNtopLevelLeaveCallback
Specifies the list of callbacks that are called when the pointer leaves a top level window or the root window (due to changing screens). the type of the structure whose address is passed to this callback is XmTopLevelLeaveCallbackStruct. the reason sent by the callback is XmCR_TOP_LEVEL_LEAVE.
XmNvalidCursorForeground
Specifies the foreground pixel value of the cursor designated as a valid cursor icon.
π Inherited Resources π
DragContext inherits behavior and resources from the superclass described in the following table. for a complete description of each resource, refer to the Core reference page. π
π Core Resource Set π
okay bestie, here's the whole core resource lineup π every single one of these has a Name, a Class, a Type, a Default, and an Access code, and we are NOT skipping a single one, fr fr:
XmNacceleratorsβ classXmCAccelerators, typeXtAccelerators, defaultdynamic, accessCSGβ¨XmNancestorSensitiveβ classXmCSensitive, typeBoolean, defaultdynamic, accessGπXmNbackgroundβ classXmCBackground, typePixel, defaultdynamic, accessCSGπXmNbackgroundPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGπ¦XmNborderColorβ classXmCBorderColor, typePixel, defaultXtDefaultForeground, accessCSGπΈXmNborderPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGβ¨XmNborderWidthβ classXmCBorderWidth, typeDimension, default0, accessCSGπXmNcolormapβ classXmCColormap, typeColormap, defaultdynamic, accessCGπXmNdepthβ classXmCDepth, typeint, defaultdynamic, accessCGπ₯XmNdestroyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCπXmNheightβ classXmCHeight, typeDimension, defaultdynamic, accessCSGπXmNinitialResourcesPersistentβ classXmCInitialResourcesPersistent, typeBoolean, defaultTrue, accessCβXmNmappedWhenManagedβ classXmCMappedWhenManaged, typeBoolean, defaultTrue, accessCSGπXmNscreenβ classXmCScreen, typeScreen *, defaultdynamic, accessCGπXmNsensitiveβ classXmCSensitive, typeBoolean, defaultTrue, accessCSGπXmNtranslationsβ classXmCTranslations, typeXtTranslations, defaultdynamic, accessCSGπ§XmNwidthβ classXmCWidth, typeDimension, defaultdynamic, accessCSGπΈXmNxβ classXmCPosition, typePosition, default0, accessCSGβ¨XmNyβ classXmCPosition, typePosition, default0, accessCSGπ¦
π Callback Information π
so every single DragContext callback comes with its own little callback structure, like a lil bestie that shows up with the receipts π«Ά
A pointer to the following structure is passed to the XmNdragDropFinishCallback callback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
}XmDragDropFinishCallbackStruct, *XmDragDropFinishCallback;
reasonβ Indicates why the callback was invoked πeventβ Points to theXEventthat triggered the callback β‘timeStampβ Specifies the time at which either the drag or the drop was completed β°
A pointer to the following structure is passed to callbacks for XmNdragMotionCallback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
unsigned char operation;
unsigned char operations;
unsigned char dropSiteStatus;
Position x;
Position y;
}XmDragMotionCallbackStruct, *XmDragMotionCallback;
reasonβ Indicates why the callback was invoked πeventβ Points to theXEventthat triggered the callback πtimeStampβ Specifies the timestamp of the logical event β±οΈoperationβ Identifies an operation π
okay so if the toolkit just called a DropSite's XmNdragProc, bestie, it sets operation to whatever the operation member of the XmDragProcCallbackStruct was holding the second that XmNdragProc handed control back. π
But if the toolkit hasn't called an XmNdragProc, and your pointer is chillin' inside an active drop site? Then it picks operation by doing a bitwise AND of the initial operations value and the DropSite's XmNdropSiteOperations resource. It scans that set like: XmDROP_MOVE first, then XmDROP_COPY, then XmDROP_LINK β and locks in the first one it finds. If none of those three show up? It's giving XmDROP_NOOP, periodt. π
And if the toolkit hasn't called an XmNdragProc and the pointer isn't inside any active drop site? Then it picks operation from the initial value of the operations member itself. Same drill: XmDROP_MOVE first, then XmDROP_COPY, then XmDROP_LINK, first match wins. Nothing found? XmDROP_NOOP again. π
operationsβ tells you the set of operations supported for the source data. β¨- If the toolkit just called a DropSite's
XmNdragProc, it setsoperationsto the bitwise AND of the DropSite'sXmNdropOperationsand theoperationsmember of theXmDragProcCallbackStructat the momentXmNdragProcreturns. If that resulting set is empty,operationsbecomesXmDROP_NOOP. - If the toolkit hasn't called an
XmNdragProcand the user didn't select an operation (by pressing a modifier key),operationsgets set to the value of the DragContext'sXmNdragOperationsresource. - If the toolkit hasn't called an
XmNdragProcand the user did select an operation,operationsbecomes the bitwise AND of that corresponding operation and the DragContext'sXmNdragOperationsresource. Empty set?XmDROP_NOOP, no cap. π«Ά
- If the toolkit just called a DropSite's
dropSiteStatusβ says whether a drop site is valid or not. πΈ- If the toolkit just called a DropSite's
XmNdragProc,dropSiteStatusgets the value of thedropSiteStatusmember of theXmDragProcCallbackStructat the timeXmNdragProcreturns. - If the toolkit hasn't called an
XmNdragProc, it initializesdropSiteStatuslike this: it'sXmNO_DROP_SITEif the pointer is over an inactive drop site, or just not over a drop site at all. - The toolkit sets
dropSiteStatustoXmDROP_SITE_VALIDonly if all these conditions are met:- The pointer is over an active drop site. π
- The DragContext's
XmNexportTargetsand the DropSite'sXmNimportTargetsare compatible. π¦ - The initial value of the
operationmember is notXmDROP_NOOP.
- Otherwise,
dropSiteStatusbecomesXmDROP_SITE_INVALID. π
- If the toolkit just called a DropSite's
A pointer to this next structure gets passed for the XmNdropFinishCallback callback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
unsigned char operation;
unsigned char operations;
unsigned char dropSiteStatus;
unsigned char dropAction;
unsigned char completionStatus;
}XmDropFinishCallbackStruct, *XmDropFinishCallback;
reasonβ tells you why the callback got invoked. πeventβ points to theXEventthat triggered the callback. β¨timeStampβ specifies the time at which the drop was completed. βoperationβ identifies an operation. π- If the pointer is over an active drop site when the drop begins, the toolkit sets
operationto the value of theoperationmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. - If the pointer is not over an active drop site when the drop begins, the toolkit picks
operationfrom the initial value of theoperationsmember. It searches that set forXmDROP_MOVEfirst, thenXmDROP_COPY, thenXmDROP_LINK, and setsoperationto the first one it finds. Finds none of them?operationbecomesXmDROP_NOOP. π
- If the pointer is over an active drop site when the drop begins, the toolkit sets
operationsβ the set of operations supported for the source data. π- If the pointer is over an active drop site when the drop begins,
operationsbecomes the bitwise AND of the DropSite'sXmNdropOperationsand the value of theoperationsmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. Empty set?XmDROP_NOOP. - If the pointer is not over an active drop site when the drop begins, and the user didn't select an operation (by pressing a modifier key),
operationsbecomes the value of the DragContext'sXmNdragOperationsresource. - If the pointer is not over an active drop site when the drop begins, and the user did select an operation,
operationsbecomes the bitwise AND of the corresponding operation and the value of the DragContext'sXmNdragOperationsresource. Empty set?XmDROP_NOOP. π
- If the pointer is over an active drop site when the drop begins,
dropSiteStatusβ whether a drop site is valid or not. π«Ά- If the pointer is over an active drop site when the drop begins,
dropSiteStatusgets the value of thedropSiteStatusmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. - If the pointer is not over an active drop site when the drop begins,
dropSiteStatusbecomesXmNO_DROP_SITE.
- If the pointer is over an active drop site when the drop begins,
dropActionβ identifies the drop action. The values areXmDROP,XmDROP_CANCEL,XmDROP_HELP, andXmDROP_INTERRUPT. Heads up bestie,XmDROP_INTERRUPTis currently unsupported β if you specify it, it gets interpreted as anXmDROP_CANCEL. πcompletionStatusβ an IN/OUT member that indicates the status of the drop action. After the last callback procedure has returned, the final value of this member determines what visual transition effects get applied. There are two values:XmDROP_SUCCESSβ the drop was successful. πXmDROP_FAILUREβ the drop was unsuccessful. π
A pointer to this next structure gets passed to callbacks for XmNdropSiteEnterCallback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
unsigned char operation;
unsigned char operations;
unsigned char dropSiteStatus;
Position x;
Position y;
}XmDropSiteEnterCallbackStruct, *XmDropSiteEnterCallback;
reasonβ tells you why the callback got invoked. πeventβ points to theXEventthat triggered the callback. β¨timeStampβ specifies the time the crossing event occurred. β°operationβ identifies an operation. π- If the toolkit just called a DropSite's
XmNdragProc,operationgets the value of theoperationmember of theXmDragProcCallbackStructat the timeXmNdragProcreturns. - If the toolkit hasn't called an
XmNdragProc, it picksoperationfrom the bitwise AND of the initial value of theoperationsmember and the value of the DropSite'sXmNdropSiteOperationsresource. It searches that set forXmDROP_MOVEfirst, thenXmDROP_COPY, thenXmDROP_LINK, and setsoperationto the first one it finds. If it finds none of these in the set,operationbecomesXmDROP_NOOP. π
- If the toolkit just called a DropSite's
operationsβ the set of operations supported for the source data. πΈ- If the toolkit just called a DropSite's
XmNdragProc,operationsbecomes the bitwise AND of the DropSite'sXmNdropOperationsand the value of theoperationsmember of theXmDragProcCallbackStructat the timeXmNdragProcreturns. Empty set?XmDROP_NOOP. - If the toolkit hasn't called an
XmNdragProcand the user didn't select an operation (by pressing a modifier key),operationsbecomes the value of the DragContext'sXmNdragOperationsresource. - If the toolkit hasn't called an
XmNdragProcand the user did select an operation,operationsbecomes the bitwise AND of the corresponding operation and the value of the DragContext'sXmNdragOperationsresource. Empty set?XmDROP_NOOP, fr fr. π«Ά
- If the toolkit just called a DropSite's
dropSiteStatusβ whether a drop site is valid or not. π- If the toolkit just called a DropSite's
XmNdragProc,dropSiteStatusgets the value of thedropSiteStatusmember of theXmDragProcCallbackStructat the timeXmNdragProcreturns.
- If the toolkit just called a DropSite's
dropSiteStatusβ the whole "is this drop site valid" tea βοΈ. If the toolkit has not calledXmNdragProc, it initializesdropSiteStatustoXmDROP_SITE_VALIDwhen the DragContext'sXmNexportTargetsand the DropSite'sXmNimportTargetsare compatible and the initial value of theoperationmember is notXmDROP_NOOP. Otherwise? Toolkit setsdropSiteStatustoXmDROP_SITE_INVALID. That's it, that's the rule πxβ the x-coordinate of the pointer, in root window coordinates. Yes bestie, root window coordinates, not local, don't get it twisted.yβ the y-coordinate of the pointer, in root window coordinates. Same deal π«Ά
A pointer to this structure gets passed to the callbacks for XmNdropSiteLeaveCallback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
}XmDropSiteLeaveCallbackStruct, *XmDropSiteLeaveCallback;
reasonβ why the callback got invoked in the first place.eventβ points at theXEventthat triggered the callback.timeStampβ the timestamp of the logical event. logical, okay?*
A pointer to this next structure is passed for the XmNdropStartCallback callback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
unsigned char operation;
unsigned char operations;
unsigned char dropSiteStatus;
unsigned char dropAction;
Position x;
Position y;
}XmDropStartCallbackStruct, *XmDropStartCallback;
reasonβ why the callback was invoked.eventβ points to theXEventthat triggered the callback.timeStampβ the time at which the drag was completed. β°operationβ identifies an operation. And okay, this one has layers, so pay attention:- If the pointer is over an active drop site when the drop begins, the toolkit initializes
operationto the value of theoperationmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. - If the pointer is not over an active drop site when the drop begins, the toolkit initializes
operationby picking one out of the initial value of theoperationsmember. It searches this set first forXmDROP_MOVE, then forXmDROP_COPY, then forXmDROP_LINK, and initializesoperationto the first one it finds in the set. If it finds none of these in the set, it initializesoperationtoXmDROP_NOOP. Iconic search order, no notes. π₯
- If the pointer is over an active drop site when the drop begins, the toolkit initializes
operationsβ the set of operations supported for the source data. Three whole scenarios, bestie:- If the pointer is over an active drop site when the drop begins, the toolkit initializes
operationsto the bitwise AND of the DropSite'sXmNdropOperationsand the value of theoperationsmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. If that resulting set is empty, the toolkit initializesoperationstoXmDROP_NOOP. - If the pointer is not over an active drop site when the drop begins and the user does not select an operation (by pressing a modifier key), the toolkit initializes
operationsto the value of the DragContext'sXmNdragOperationsresource. - If the pointer is not over an active drop site when the drop begins and the user does select an operation, the toolkit initializes
operationsto the bitwise AND of the corresponding operation and the value of the DragContext'sXmNdragOperationsresource. Empty set? Toolkit initializesoperationstoXmDROP_NOOP. Periodt.
- If the pointer is over an active drop site when the drop begins, the toolkit initializes
dropSiteStatusβ whether or not a drop site is valid:- If the pointer is over an active drop site when the drop begins, the toolkit initializes
dropSiteStatusto the value of thedropSiteStatusmember of theXmDropProcCallbackStructat the time the DropSite'sXmNdropProcreturns. - If the pointer is not over an active drop site when the drop begins, the toolkit initializes
dropSiteStatustoXmNO_DROP_SITE.
- If the pointer is over an active drop site when the drop begins, the toolkit initializes
β οΈ This field is invalid if thedropActionfield is set toXmDROP_CANCEL. Read that again, bestie, it matters π
dropActionβ an IN/OUT member that identifies the drop action. The values areXmDROP,XmDROP_CANCEL,XmDROP_HELP, andXmDROP_INTERRUPT. You can modify the value ofdropActionto change the action actually initiated. Heads up though:XmDROP_INTERRUPTis currently unsupported β if you specify it, it will be interpreted as anXmDROP_CANCEL. So likeβ¦ don't πxβ the x-coordinate of the pointer in root window coordinates.yβ the y-coordinate of the pointer in root window coordinates.
A pointer to this structure is passed to the XmNoperationChangedCallback callback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
unsigned char operation;
unsigned char operations;
unsigned char dropSiteStatus;
}XmOperationChangedCallbackStruct, *XmOperationChangedCallback;
reasonβ why the callback was invoked.eventβ points to theXEventthat triggered the callback.timeStampβ the time at which the crossing event occurred. πΈoperationβ identifies an operation. And again, three branches, so let's go:- If the toolkit has just called a DropSite's
XmNdragProc, the toolkit initializesoperationto the value of theoperationmember of theXmDragProcCallbackStructat the time the DropSite'sXmNdragProcreturns. - If the toolkit has not called an
XmNdragProc, and the pointer is within an active drop site, the toolkit initializesoperationby selecting an operation from the bitwise AND of the initial value of theoperationsmember and the value of the DropSite'sXmNdropSiteOperationsresource. It searches this set first forXmDROP_MOVE, then forXmDROP_COPY, then forXmDROP_LINK, and initializesoperationto the first one it finds in the set. Finds none of them? InitializesoperationtoXmDROP_NOOP. - If the toolkit has not called an
XmNdragProc, and the pointer is not within an active drop site, the toolkit initializesoperationby selecting an operation from the initial value of theoperationsmember. Same search order β firstXmDROP_MOVE, thenXmDROP_COPY, thenXmDROP_LINKβ andoperationbecomes the first one it finds. None found?operationgets initialized toXmDROP_NOOP.
- If the toolkit has just called a DropSite's
operationsβ the set of operations supported for the source data:- If the toolkit has just called a DropSite's
XmNdragProc, the toolkit initializesoperationsto the bitwise AND of the DropSite'sXmNdropOperationsand the value of theoperationsmember of theXmDragProcCallbackStructat the time the DropSite'sXmNdragProcreturns. If the resulting set of operations is empty, the toolkit initializesoperationstoXmDROP_NOOP. - If the toolkit has not called an
XmNdragProc, and the user does not select an operation (by pressing a modifier key), the toolkit initializesoperationsto the value of the DragContext'sXmNdragOperationsresource. - If the toolkit has not called an
XmNdragProc, and the user does select an operation, the toolkit initializesoperationsto the bitwise AND of the corresponding operation and the value of the DragContext'sXmNdragOperationsresource. Empty set again? Toolkit initializesoperationstoXmDROP_NOOP. Every single time, bestie π«Ά
- If the toolkit has just called a DropSite's
dropSiteStatusβ whether or not a drop site is valid:- If the toolkit has just called a DropSite's
XmNdragProc, the toolkit initializesdropSiteStatusto the value of thedropSiteStatusmember of theXmDragProcCallbackStructat the time the DropSite'sXmNdragProcreturns. - If the toolkit has not called an
XmNdragProc, it initializesdropSiteStatustoXmNO_DROP_SITEif the pointer is over an inactive drop site or is not over a drop site at all. - The toolkit initializes
dropSiteStatustoXmDROP_SITE_VALIDif all of the following conditions are met:- The pointer is over an active drop site
- The DragContext's
XmNexportTargetsand the DropSite'sXmNimportTargetsare compatible - The initial value of the
operationmember is notXmDROP_NOOP
- Otherwise, the toolkit initializes
dropSiteStatustoXmDROP_SITE_INVALID.
- If the toolkit has just called a DropSite's
A pointer to this structure is passed to the callbacks for XmNtopLevelEnterCallback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
Screen screen;
Window window;
Position x;
Position y;
unsigned char dragProtocolStyle;
}XmTopLevelEnterCallbackStruct, *XmTopLevelEnterCallback;
reasonβ why the callback was invoked.eventβ points to theXEventthat triggered the callback.timeStampβ the timestamp of the logical event.screenβ the screen associated with the top-level window or root window being entered.windowβ the ID of the top-level window or root window being entered.xβ the x-coordinate of the pointer in root window coordinates.yβ the y-coordinate of the pointer in root window coordinates.dragProtocolStyleβ the protocol style adopted by the initiator. The values areXmDRAG_DROP_ONLY,XmDRAG_DYNAMIC,XmDRAG_NONE, andXmDRAG_PREREGISTER. β¨
A pointer to this structure is passed to the callbacks for XmNtopLevelLeaveCallback:
typedef struct
{
int reason;
XEvent *event;
Time timeStamp;
Screen screen;
Window window;
}XmTopLevelLeaveCallbackStruct, *XmTopLevelLeaveCallback;
reasonβ why the callback was invoked.eventβ points to theXEventthat triggered the callback.timeStampβ the timestamp of the logical event.screenβ the screen that's attached to the top-level window (or root window) you're leaving π¨windowβ the ID of the top-level window or root window that's getting left behind π
π« Translations π«
okay so the XmDragContext translations are all listed below, bestie. The key names follow the X standard key event translation table syntax β that's the exact format Motif uses to say "this key = this widget action," iykyk. There's a lil overview of the format over in VirtualBindings(3), and if you want the whole breakdown you gotta hit up the X Toolkit Intrinsics Documentation. fr fr. π
Button1<Enter>:DragMotion()Button1<Leave>:DragMotion()Button1<Motion>:DragMotion()Button2<Enter>:DragMotion()Button2<Leave>:DragMotion()Button2<Motion>:DragMotion()<Btn2Up>:FinishDrag()<Btn1Up>:FinishDrag()<Key>Return:FinishDrag()<Key><osfActivate>:FinishDrag()<BtnDown>:IgnoreButtons()<BtnUp>:IgnoreButtons():<Key><osfCancel>:CancelDrag():<Key><osfHelp>:HelpDrag():<Key><osfUp>:DragKey(Up):<Key><osfDown>:DragKey(Down):<Key><osfLeft>:DragKey(Left):<Key><osfRight>:DragKey(Right):<KeyUp>:DragKey(Update):<KeyDown>:DragKey(Update)
πΈ note bestie: those leading : marks on the osf ones? yeah, they're literally in the table. copy them exactly, don't get cute. π
π¬ Action Routines π¬
the XmDragContext action routines are, in no particular order of slay:
CancelDrag()β cancels the whole drag operation and frees the associated DragContext. it's giving "we're so done here" πDragKey(String)β ifStringisLeft,Right,Up, orDown, this moves the dragged object to the corresponding location. any other value ofString? ignored. periodt. π«DragMotion()β drags the selected data along as the pointer moves. main character behavior honestly β¨FinishDrag()β finishes the drag operation and kicks off the drop operation. the handoff. the moment. π₯HelpDrag()β initiates a conditional drop that lets the receiver give the user help info. the user can then either cancel or continue the drop in response to that info. choices, we love them π«Ά
π§ Virtual Bindings π§
the bindings for virtual keys are vendor specific β no universal answer, sorry bestie π. if you want the tea on bindings for virtual buttons and keys, go read VirtualBindings(3).
π RELATED INFORMATION π
go read these, they're all part of the lore: Core(3), XmDisplay(3), XmDragCancel(3), XmDragIcon(3), XmDragStart(3), XmDropSite(3), XmDropTransfer(3), and XmScreen(3). that's the whole friend group π
and that's a wrap on the whole page, bestie!! π this one's from the XmDragContext(library call) era β the library-call section of the manual, iconic as always. go forth and drag responsibly ππ
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms