xtselectioc(3) [hpux man page]
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 transferred. target Specifies the target type to which the conversion was done. Description An XtSelectionDoneProc is optionally registered in a call to XtOwnSelection(), 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 XtConvertSelectionProc 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 automat- ically 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 XtSelectionDoneProc. 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 XtOwnSe- lectionIncremental(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 Also XtDisownSelection(1), XtGetSelectionValue(1), XtGetSelectionValues(1), XtOwnSelection(1), XtOwnSelectionIncremental(1), XtConvertSelectionProc(2). Xt - Selections XtSelectionDoneProc()
Check Out this Related Man Page
XtOwnSelection(3Xt) XtOwnSelection(3Xt) NAME
XtOwnSelection, XtOwnSelectionIncremental, XtDisownSelection - set selection owner SYNOPSIS
Boolean XtOwnSelection(w, selection, time, convert_proc, lose_selection, done_proc) Widget w; Atom selection; Time time; XtConvertSelectionProc convert_proc; XtLoseSelectionProc lose_selection; XtSelectionDoneProc done_proc; Boolean XtOwnSelectionIncremental(w, selection, time, convert_callback, lose_callback, done_callback, cancel_callback, client_data) Widget w; Atom selection; Time time; XtConvertSelectionIncrProc convert_callback; XtLoseSelectionIncrProc lose_callback; XtSelectionDoneIncrProc done_callback; XtCancelConvertSelectionProc cancel_callback; XtPointer client_data; void XtDisownSelection(w, selection, time) Widget w; Atom selection; Time time; ARGUMENTS
Specifies the procedure that is to be called whenever someone requests the current value of the selection. Specifies the procedure that is called after the requestor has received the selection or NULL if the owner is not interested in being called back. Specifies the procedure that is to be called whenever the widget has lost selection ownership or NULL if the owner is not interested in being called back. Speci- fies an atom that describes the type of the selection (for example, XA_PRIMARY, XA_SECONDARY, or XA_CLIPBOARD). Specifies the timestamp that indicates when the selection ownership should commence or is to be relinquished. Specifies the widget that wishes to become the owner or to relinquish ownership. DESCRIPTION
The XtOwnSelection function informs the Intrinsics selection mechanism that a widget believes it owns a selection. It returns True if the widget has successfully become the owner and False otherwise. The widget may fail to become the owner if some other widget has asserted ownership at a time later than this widget. Note that widgets can lose selection ownership either because someone else asserted later own- ership of the selection or because the widget voluntarily gave up ownership of the selection. Also note that the lose_selection procedure is not called if the widget fails to obtain selection ownership in the first place. The XtOwnSelectionInrcremental procedure informs the Intrinsics incremental selection mechanism that the specified widget wishes to own the selection. It returns True if the specified widget successfully becomes the selection owner or False otherwise. For more information about selection, target, and time, see Section 2.6 of the Inter-Client Communication Conventions Manual. A widget that becomes the selection owner using XtOwnSelectionIncremental may use XtDisownSelection to relinquish selection ownership. The XtDisownSelection function informs the Intrinsics selection mechanism that the specified widget is to lose ownership of the selection. If the widget does not currently own the selection either because it lost the selection or because it never had the selection to begin with, XtDisownSelection does nothing. After a widget has called XtDisownSelection, its convert procedure is not called even if a request arrives later with a timestamp during the period that this widget owned the selection. However, its done procedure will be called if a conversion that started before the call to XtDisownSelection finishes after the call to XtDisownSelection. SEE ALSO
XtAppGetSelectionTimeout(3Xt), XtGetSelectionValue(3Xt) X Toolkit Intrinsics -- C Language Interface Xlib C Language X Interface XtOwnSelection(3Xt)