XtSelectionDoneProc()XtSelectionDoneProc()Name
XtSelectionDoneProc - interface definition for procedure called after
selection transfer is completed.
Synopsis
typedef void (*XtSelectionDoneProc)(Widget, Atom *, Atom *);
Widget w;
Atom *selection;
Atom *target;
Inputs
w Specifies the widget that owns the converted selection.
selection Specifies the atom that names the selection that was trans‐
ferred.
target Specifies the target type to which the conversion was done.
Description
An XtSelectionDoneProc is optionally registered in a call to XtOwnSe‐
lection(), and is called by the Intrinsics after the corresponding
XtConvertSelectionProc has been called and the data it returns is
transferred to the requestor.
An XtSelectionDoneProc should free the memory returned by the XtCon‐
vertSelectionProc and any other memory or resources allocated by that
procedure to convert the selection value. If no XtSelectionDoneProc is
registered with XtOwnSelection(), then the Intrinsics will automati‐
cally free the memory returned by the XtConvertSelectionProc by calling
XtFree().
Usage
Most XtConvertSelectionProc procedures will allocate a single block of
memory with XtMalloc() and can simply rely on the Intrinsics to free
that block with XtFree(). In this case, there is no need for an XtSe‐
lectionDoneProc.
Note that an XtSelectionDoneProc is not passed a client_data argument,
nor is it passed a pointer to the memory that was returned by the
XtConvertSelectionProc. In a widget, the widget structure can point to
the memory that must be freed, but in an application, you will probably
have to rely on a global variable, as in the example below.
The XtSelectionDoneProc and XtOwnSelection() are part of the Intrinsics
atomic selection transfer mechanism. For some selection values, it may
be more convenient to transfer the selection value in pieces. This can
be done with the incremental transfer mechanism; see XtOwnSelectionIn‐
cremental(1).
Example
The xcalc client uses a static character string to store the selection
value. Because this is not allocated memory, it should not be freed,
so xcalc provides a XtSelectionDoneProc which simply sets the static
buffer to contain the empty string:
static char selstr[LCD_STR_LEN]; /* storage for selections from the LCD */
/*ARGSUSED*/
void done(w, selection, target)
Widget w;
Atom *selection;
Atom *target;
{
selstr[0] = ' ';
}
This XtSelectionDoneProc is registered with this call:
XtOwnSelection(LCD, XA_PRIMARY, time, convert, lose, done);
See AlsoXtDisownSelection(1), XtGetSelectionValue(1), XtGetSelectionValues(1),
XtOwnSelection(1), XtOwnSelectionIncremental(1),
XtConvertSelectionProc(2).
Xt - Selections XtSelectionDoneProc()