
Example 18-11. Sample conversion procedure
–
SelectionConvertProc (continued)
} else
/* Call the default selection conversion procedure.
* It handles requests for any pre-registered
* conversions, including TARGETS.
*/
return(sel_convert_proc(sel, target, data, length, format));
}
18.8.1 The Done Procedure
The selection done procedure is called after each conversion has happened. This gives the
application a chance to free up memory.
void
SelectionDoneProc(sel, data, target)
Selection_owner sel;
Xv_opaque data;
Atom target;
{
if (target == ATOM(server, "STRING"))
free((char *)data);
}
Note, in this example, we only alloc data for string requests so we only free it for string data.
18.8.2 The Lose Procedure
The lose procedure lets the selection package lose ownership a selection gracefully. For
example, the user can can be informed that the selection was lost, as in the following
example.
void
SelectionLoseProc(sel)
Selection_owner sel;
{
xv_set(frame, FRAME_LEFT_FOOTER, "Lost Selection...", NULL);
}
Selections
Selections 423